Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devcontainer exits with alpine and compose #10618

Closed
btrepp opened this issue Jan 8, 2025 · 2 comments
Closed

Devcontainer exits with alpine and compose #10618

btrepp opened this issue Jan 8, 2025 · 2 comments
Assignees
Labels
containers Issue in vscode-remote containers

Comments

@btrepp
Copy link

btrepp commented Jan 8, 2025

  • VSCode Version:
    Version: 1.95.3 (Universal)
    Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813
    Date: 2024-11-13T14:50:04.152Z
    Electron: 32.2.1
    ElectronBuildId: 10427718
    Chromium: 128.0.6613.186
    Node.js: 20.18.0
    V8: 12.8.374.38-electron.0
    OS: Darwin arm64 23.6.0
  • Remote OS Version: alpine 3.21
  • Remote Extension/Connection Type: Dev Containers
  • Logs:
[2025-01-08T10:55:11.852Z] Stop (18 ms): Run: docker ps -q -a --filter label=com.docker.compose.project=environment_devcontainer --filter label=com.docker.compose.service=devcontainer
[2025-01-08T10:55:11.852Z] Start: Run: docker inspect --type container 950dce001e95
[2025-01-08T10:55:11.907Z] Stop (55 ms): Run: docker inspect --type container 950dce001e95
[2025-01-08T10:55:11.909Z] Start: Inspecting container
[2025-01-08T10:55:11.909Z] Start: Run: docker inspect --type container 950dce001e957aba407d6dfc57b21b9979422fd982db2df8b2444744da5bd9d2
[2025-01-08T10:55:11.926Z] Stop (17 ms): Run: docker inspect --type container 950dce001e957aba407d6dfc57b21b9979422fd982db2df8b2444744da5bd9d2
[2025-01-08T10:55:11.926Z] Stop (17 ms): Inspecting container
[2025-01-08T10:55:11.928Z] Start: Run in container: /bin/sh
[2025-01-08T10:55:11.929Z] Start: Run in container: uname -m
[2025-01-08T10:55:11.943Z] Stop (15 ms): Run in container: /bin/sh
[2025-01-08T10:55:11.944Z] Shell server terminated (code: 1, signal: null)
[2025-01-08T10:55:11.944Z] Error response from daemon: container 950dce001e957aba407d6dfc57b21b9979422fd982db2df8b2444744da5bd9d2 is not running
[2025-01-08T10:55:11.944Z] Start: Run in container:  (command -v getent >/dev/null 2>&1 && getent passwd 'vscode' || grep -E '^vscode|^[^:]*:[^:]*:vscode:' /etc/passwd || true)
[2025-01-08T10:55:11.944Z] Stdin closed!
[2025-01-08T10:55:11.946Z] Error: An error occurred setting up the container.
[2025-01-08T10:55:11.946Z]     at htA (/Users/btrepp/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/spec-node/devContainersSpecCLI.js:410:3955)
[2025-01-08T10:55:11.946Z]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2025-01-08T10:55:11.946Z]     at async TtA (/Users/btrepp/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/spec-node/devContainersSpecCLI.js:482:4021)
[2025-01-08T10:55:11.946Z]     at async iB (/Users/btrepp/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/spec-node/devContainersSpecCLI.js:482:4963)
[2025-01-08T10:55:11.946Z]     at async wrA (/Users/btrepp/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/spec-node/devContainersSpecCLI.js:663:203)
[2025-01-08T10:55:11.946Z]     at async DrA (/Users/btrepp/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/spec-node/devContainersSpecCLI.js:662:14830)
[2025-01-08T10:55:11.946Z]     at async /Users/btrepp/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/spec-node/devContainersSpecCLI.js:482:1190
[2025-01-08T10:55:11.949Z] Stop (1044 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Users/btrepp/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/beautrepp/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-3050e086-aa77-4bba-9663-2f5cfaee81ef1736333710249 --workspace-folder /Users/btrepp/Documents/source/repos/environment --workspace-mount-consistency cached --gpu-availability detect --id-label devcontainer.local_folder=/Users/btrepp/Documents/source/repos/environment --id-label devcontainer.config_file=/Users/btrepp/Documents/source/repos/environment/.devcontainer/devcontainer.json --log-level debug --log-format json --config /Users/btrepp/Documents/source/repos/environment/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[2025-01-08T10:55:11.949Z] Exit code 1
[2025-01-08T10:55:11.951Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Users/btrepp/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/btrepp/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-3050e086-aa77-4bba-9663-2f5cfaee81ef1736333710249 --workspace-folder /Users/btrepp/Documents/source/repos/environment --workspace-mount-consistency cached --gpu-availability detect --id-label devcontainer.local_folder=/Users/btrepp/Documents/source/repos/environment --id-label devcontainer.config_file=/Users/btrepp/Documents/source/repos/environment/.devcontainer/devcontainer.json --log-level debug --log-format json --config /Users/btrepp/Documents/source/repos/environment/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[2025-01-08T10:55:11.952Z] Exit code 1

Steps to Reproduce:

  1. Create a devcontainer using compose and alpine base

Likely cause:

Devcontainers override entry point and command, this is good!.

"Path": "/bin/sh",
	"Args": [
		"-c",
		"echo Container started\n trap \"exit 0\" 15\n \n exec \"$@\"\n while sleep 1 & wait $!; do :; done",
		"-",
		"/bin/sh"
	],

I recall ash (alpines default) possibly not playing nicer with bashishms. So I am wondering if this block is actually compatible with sh, or has something that only works in bash?. I've noticed most symlinked bashes to /bin/sh usually just run it as bash, not as sh

Also of note: overrideCommand: false seems ignored for compose files, unsure why that is, or if it's related, but makes it a bit difficult to force it to work. I have made this work in other containers though, so it's usually work-around able, but its strange behaviour to be sure

@btrepp
Copy link
Author

btrepp commented Jan 8, 2025

Ah

command: sleep infinity in the compose file fixes it. Though strange as not in compose, this is not required.

For others who find this, overrideCommand is misleading, it seems to always inject its own stuff, but overrideCommands behaviour is whether it still calls the original entry points or not it seems. It probably should be named 'disableDefaultEntrypoint' rather than override, as it seems that's its purpose.

I've solved this for me, but will leave it open in case the devs want to understand the compose/vs container differences, if not I imagine a GitHub bot will auto-close this at some point :)

@vs-code-engineering vs-code-engineering bot added the containers Issue in vscode-remote containers label Jan 8, 2025
@chrmarti
Copy link
Contributor

chrmarti commented Jan 9, 2025

You could use "overrideCommand": true instead of command: sleep infinity. overrideCommand is false for Docker Compose for historical reasons, it is true for single containers.

@chrmarti chrmarti closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issue in vscode-remote containers
Projects
None yet
Development

No branches or pull requests

2 participants