`devcontainer exec` tries to use different container than the response of `devcontainer up` in WSL
See original GitHub issuedevcontainer exec
tries to use different container than the response of devcontainer up
.
$ devcontainer up --workspace-folder .
[14 ms] @devcontainers/cli 0.12.1.
{"outcome":"success","containerId":"66d0453b1f8340282242c2efeff1e79af03734b45d56cfc7630b5b92b108880e","composeProjectName":"masked","remoteUser":"vscode","remoteWorkspaceFolder":"/workspace"}
$ devcontainer exec --workspace-folder . pwd
Shell server terminated (code: 1, signal: null)
Error response from daemon: Container 7a07354654d1bc329e8ba1ba2721582171fe483c541e5ee65f042c9dc6d7fe4f is not running
{"outcome":"error","message":"An error occurred running a command in the container.","description":"An error occurred running a command in the container."}
Version info: devcontainer@0.12.1 /home/sarisia/.asdf/installs/nodejs/18.5.0/.npm/lib/node_modules/@devcontainers/cli
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Add option to allow running devcontainer inside a WSL2 ...
So my suggestion is to add an option in "Remote - Containers" that translate the Windows Path to WSL mount path using the...
Read more >Visual Studio Code Dev Containers Frequently Asked Questions
Dev Containers FAQ. This article includes some of the common questions for getting the Dev Containers extension up and running in different environments....
Read more >VS Code Remote / GitHub Codespaces Development ...
Development container images for use with VS Code Remote - Containers and GitHub ... Their contents, and corresponding devcontainer.json files are typically ...
Read more >How to copy files from local machine to docker container on ...
Use docker cp . docker cp c:\path\to\local\file container_name:/path/to/target/dir/. If you don't know what's the name of the container, ...
Read more >Run GUI app in linux docker container on windows host
I wanted to be able to use the Evolution mail client and other handy ... If I open a terminal into the container...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had this problem when first trying this project out, with this process:
devcontainer up --workspace-folder .
, which reported success:devcontainer exec --workspace-folder . /bin/bash
and got this:Manually stopping the container, rebuilding it using the CLI and relaunching, then starting VS Code and separately running
devcontainer exec ...
seems to work.If the container is launched first via VS Code,
devcontainer exec ...
cannot find the container.The workaround I’ve found is to manually stop the devcontainer (if it was built with VSCode) then run:
devcontainer up --remove-existing-container --workspace-folder .
and finally:devcontainer exec --workspace-folder . /bin/bash
My goal is for my team to be able to use VSCode or the CLI/Terminal interchangeably with the same container.
using the explicit
--container-id
parameter on the exec command seems to work around this, although I still have trouble with #246The extension is using the UNC path for
"devcontainer.local_folder"
, so it can distinguish between the same folder in different WSL distributions. The CLI inside a distribution is not aware of this.