An error occurred setting up the container.
When I try to start a container using the CLI I often get an error like this:
13:38:18 @devcontainers/cli 0.46.0. Node.js v16.20.1. linux 5.4.0-155-generic x64.
Error: Command failed: docker start c1c93c716532a57e4c84fd7ee447f7960f05cf72f0615fa40a3628dd9243a83b
at Rte (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2007:1066)
at QN (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2007:1002)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Zte (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2024:3660)
at async Kf (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2024:4775)
at async wne (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2156:12125)
at async bne (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2156:11866)
{"outcome":"error","message":"Command failed: docker start c1c93c716532a57e4c84fd7ee447f7960f05cf72f0615fa40a3628dd9243a83b","description":"An error occurred setting up the container.","containerId":"c1c93c716532a57e4c84fd7ee447f7960f05cf72f0615fa40a3628dd9243a83b"}
Unfortunately the error message is pretty general. Initially I thought this was caused by me switching back and forth between using the devcontainer inside VS Code and from the command line. But now it also happens on the CI/CD server where it is only started via the CLI.
The status of the container at this point is this:
$ docker ps -a --no-trunc
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c1c93c716532a57e4c84fd7ee447f7960f05cf72f0615fa40a3628dd9243a83b vsc-xxx-d1d3c3484eb3a4c77684abc59ed03e8647e616422185ee5ef699f2f71e65d149-features-uid "/bin/sh -c 'echo Container started\ntrap \"exit 0\" 15\n/usr/local/share/ssh-init.sh\nexec \"$@\"\nwhile sleep 1 & wait $!; do :; done' -" 55 minutes ago Exited (0) 54 minutes ago happy_diffie
Deleting the container and restarting helps as a workaround locally, but cannot be done in the CI/CD pipeline.
Hi 👋
Can you help update the CLI version to latest (ie 0.50.2) and see if it helps? If not, can you provide us with logs, make sure to set the logging level to trace. Thanks!
Hi,
thanks for your reply. Changing the log level inside VS Code does not change the outputs of the CLI for me. How can I change the log level on the command line?
Hello,
I found the --log-level trace option.
So when I run this:
devcontainer up --workspace-folder my-folder --id-label my-label --additional-features {"./local-features/ssh-agent-cli":{}} --log-level trace
I get the following output: `[1 ms] @devcontainers/cli 0.50.2. Node.js v18.16.1. linux 5.15.90.1-microsoft-standard-WSL2 x64. [1 ms] Start: Run: docker buildx version [145 ms] Stop (144 ms): Run: docker buildx version [146 ms] [146 ms] docker: 'buildx' is not a docker command. See 'docker --help'
[146 ms] Exit code 1 [146 ms] Start: Resolving Remote [337 ms] Start: Run: docker ps -q -a --filter label=my-label [469 ms] Stop (132 ms): Run: docker ps -q -a --filter label=my-label [469 ms] Start: Run: docker inspect --type container bc2a996cd45d [623 ms] Stop (154 ms): Run: docker inspect --type container bc2a996cd45d [623 ms] Start: Starting container [623 ms] Start: Run: docker start bc2a996cd45d8985d0320d465f6df49533a126b6d0067edacb99056559977996 [712 ms] Stop (89 ms): Run: docker start bc2a996cd45d8985d0320d465f6df49533a126b6d0067edacb99056559977996 Error: Command failed: docker start bc2a996cd45d8985d0320d465f6df49533a126b6d0067edacb99056559977996 at oAA (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:462:1066) at mK (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:462:1002) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async mAA (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:479:3660) at async LC (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:479:4775) at async jeA (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:611:12219) at async _eA (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:611:11960) {"outcome":"error","message":"Command failed: docker start bc2a996cd45d8985d0320d465f6df49533a126b6d0067edacb99056559977996","description":"An error occurred setting up the container.","containerId":"bc2a996cd45d8985d0320d465f6df49533a126b6d0067edacb99056559977996"}`
Hmm, interesting! The logs doesn't seem to have much information. @janschatz-hms would it be possible for you to send me repro steps (ie sample dev container config)? Thanks!
devcontainer up --workspace-folder my-folder --id-label my-label --additional-features {"./local-features/ssh-agent-cli":{}} --log-level trace
It's Interesting to see the use of --additional-feature flag, curious, does the container work fine if you skip it?
ie. Can you try running 👇
devcontainer up --workspace-folder my-folder --id-label my-label --log-level trace
I ran into this same thing in CI this week, and similar to the above, adding --log-level trace didn't help given me anything useful, see https://github.com/devcontainers/ci/issues/259. In the end I used docker commands in scripts in the CI run to figure out that an old devcontainer was still hanging around from a previous CI run, and couldn't be started.
I wish the "shutdown" story on devcontainers (esp in CI) was better.
Assuming this was resolved by removing an old container.