Skip to content

Remote container with Docker Compose: Dockerfile with ENTRYPOINT and COMMAND specified not supported #6861

@fredrikaverpil

Description

@fredrikaverpil

Problem description

The vscode-provided docker-compose.yml file does not seem to support the case where Dockerfile defines both ENTRYPOINT and COMMAND.

I feel this is something that used to be supported, as I've had a Dockerfile for some time with this setup and it doesn't work anymore...

Steps to Reproduce:

  1. Clone https://github.com/fredrikaverpil/devcontainer and open the repo in vscode
  2. Run "Reopen in container" on macOS ARM/M1

Does this issue occur when you try this locally?: Yes, I run the "Reopen in container" locally on my mac.
Does this issue occur when you try this locally and all extensions are disabled?: Haven't tried this as I don't think it's related.

More info

I run "Reopen in container" on macOS/ARM but get a crash anytime I use docker-compose. It works fine if I don't use docker compose.

I suspect I'm doing something wrong, but I have a hard time understanding what this means:

[2022-06-11T15:45:39.828Z] Error response from daemon: Container 91cbd0e3cc4b6891f9ffc6b6ae4c84350978030f2a8619af7be43783f1c0cb3b is not running
[2022-06-11T15:45:39.827Z] Start: Run in container: cat /etc/passwd
[2022-06-11T15:45:39.827Z] Stdin closed!
[2022-06-11T15:45:39.828Z] Error: An error occurred setting up the container.
[2022-06-11T15:45:39.828Z]     at PR (/Users/fredrik/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.2/dist/spec-node/devContainersSpecCLI.js:188:2577)
[2022-06-11T15:45:39.828Z]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-06-11T15:45:39.828Z]     at async zR (/Users/fredrik/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.2/dist/spec-node/devContainersSpecCLI.js:245:2177)
[2022-06-11T15:45:39.828Z]     at async nb (/Users/fredrik/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.2/dist/spec-node/devContainersSpecCLI.js:245:3110)
[2022-06-11T15:45:39.829Z]     at async JR (/Users/fredrik/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.2/dist/spec-node/devContainersSpecCLI.js:245:13046)
[2022-06-11T15:45:39.829Z]     at async KR (/Users/fredrik/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.2/dist/spec-node/devContainersSpecCLI.js:245:12802)
[2022-06-11T15:45:39.830Z] Stop (6051 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/fredrik/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.2/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/fredrik/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/fredrik/code/repos/devcontainer --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/fredrik/code/repos/devcontainer --log-level debug --log-format json --config /Users/fredrik/code/repos/devcontainer/.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 true
[2022-06-11T15:45:39.830Z] Exit code 1
[2022-06-11T15:45:39.830Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/fredrik/.vscode/extensions/ms-vscode-remote.remote-containers-0.238.2/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/fredrik/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/fredrik/code/repos/devcontainer --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/fredrik/code/repos/devcontainer --log-level debug --log-format json --config /Users/fredrik/code/repos/devcontainer/.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 true
[2022-06-11T15:45:39.830Z] Exit code 1

I tried running the command closest to the error without "daemonizing" it:

docker-compose --project-name devcontainer -f /Users/fredrik/code/repos/devcontainer/docker-compose.yml -f /Users/fredrik/code/repos/devcontainer/.devcontainer/docker-compose.yml -f "/Users/fredrik/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.containerFeatures-1654962339160.yml" up   
[+] Running 1/0
 ⠿ Container devcontainer-hello-1  Created                                                                                                                                                                                                             0.0s
Attaching to devcontainer-hello-1
devcontainer-hello-1  | Container started
devcontainer-hello-1  | SyntaxError: Non-UTF-8 code starting with '\xf9' in file /bin/sh on line 2, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
devcontainer-hello-1 exited with code 1

The vscode-provided compose YAML looks like this (note how it brings back the original ENTRYPOINT value of python):

services:
  'hello':
    entrypoint: ["/bin/sh", "-c", "echo Container started\n
trap \"exit 0\" 15\n
\n
exec \"$$@\"\n
while sleep 1 & wait $$!; do :; done", "-", "python"]
    labels:
      - devcontainer.local_folder=/Users/fredrik/code/repos/devcontainer
    volumes:
      - vscode:/vscode
volumes:
  vscode:
    external: true

Making this work

If I comment out the ENTRYPOINT from the Dockerfile, I can successfully run "Reopen in container" without errors.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugcontainersIssue in vscode-remote containersupstreamIssue identified as 'upstream' component related (exists outside of VS Code Remote)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions