microsoft / microsoft/vscode-remote-release
Dev Containers: reconnecting to existing subfolder config container fails with "devcontainer.json not found"
@chrmarti is already working on this.
Since Apr 22, 2026.
- Dominant language
- Dockerfile
- Stars
- 4.2k
- Forks
- 469
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
VS Code version: 1.116.0
Dev Containers extension: 0.454.0
Connection type: Containers
Host OS: macOS darwin/arm64
Remote OS: linux/arm64 (Docker Desktop 4.67.0 / Docker Engine 29.3.1)
Description
When a dev container was originally created from a subfolder config, reconnecting
to the container — whether it is running or stopped — fails with:
Error: Dev container config (.devcontainer/devcontainer.json) not found.
Reproduced with all extensions disabled.
Reproducible steps
- Create a workspace folder with the following structure — no root-level
devcontainer.json:.devcontainer/ node/ devcontainer.json Dockerfile python/ devcontainer.json Dockerfile - Run "Dev Containers: Open Folder in Container...", select either the
node
orpythonconfig when prompted — container builds and connects successfully. - Disconnect (close window, hibernate, or set
"shutdownAction": "stopContainer"). - Attempt to reconnect via "Reopen in Container" or by reopening the folder in VS Code.
Expected behaviour
The extension reconnects to (or restarts) the existing container using the same
config it was originally built from.
Actual behaviour
The CLI is invoked without --config, so it falls back to looking for
.devcontainer/devcontainer.json at the root, which does not exist. Exit code 1.
Root cause (identified)
The stopped container already has the correct config path recorded in its label:
"devcontainer.config_file": "/path/to/.devcontainer/python/devcontainer.json"
The extension reads this label to locate the container (via
docker ps --filter label=devcontainer.local_folder=...) but does not subsequently
pass --config <devcontainer.config_file> when invoking the CLI up command.
CLI invocation (actual):
devContainersSpecCLI.js up \
--workspace-folder /path/to/repo \
--id-label devcontainer.local_folder=/path/to/repo \
--skip-post-create ...
CLI invocation (expected):
devContainersSpecCLI.js up \
--workspace-folder /path/to/repo \
--config /path/to/repo/.devcontainer/python/devcontainer.json \
--id-label devcontainer.local_folder=/path/to/repo \
--skip-post-create ...
Workaround
Use "Dev Containers: Open Folder in Container..." and re-select the config each
time. This command correctly passes --config to the CLI and does not trigger
a rebuild — it finds the existing stopped container by its labels, starts it, and attaches.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.