microsoft / microsoft/vscode-remote-release
Docker-Compose Dev Container Setup Cannot use multi window dev-containers and use .devcontainer.json features
@chrmarti is already working on this.
Since Jul 27, 2023.
- Dominant language
- Dockerfile
- Stars
- 4.2k
- Forks
- 470
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
- VSCode Version: Version: 1.80.1
Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771
Date: 2023-07-12T17:20:23.298Z
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin x64 22.5.0 - Remote Extension/Connection Type: Containers
Title: Unable to Apply Features and Settings from Multiple .devcontainer.json Files Simultaneously
Description
The Visual Studio Code dev container environment only seems to acknowledge and deploy "features" key from one .devcontainer.json file at a time. This issue persists irrespective of the number of dev containers deployed, effectively allowing only a single dev container to leverage these "features" such as common utils at once.
Reproduction Steps
- Set up multiple Docker files.
- Create
.devcontainer.jsonfiles as per the instructions at Advanced Containers - Connect Multiple Containers. - Add features as to the .devcontainer.json
- Initiate connection via Docker Compose following steps to open different sub-folders in containers.
- The containers will open, but only one
.devcontainer.jsonfile will be acknowledged via the command pallet at a time. - When you build them individually using the devcontainer CLI, only the first directory built will have the features enabled, regardless of the underlying OS shared by all Docker containers. However, manually building will add in the other .devcontain.json features
For example:
bash
devcontainer build go-http; devcontainer build python-http; devcontainer build ts-http
10. Refer to the directory structure and example .devcontainer.json file given below for more context.
Directory Structure
.
├── app
├── docker-compose.yaml
├── go-http
│ ├── .devcontainer.json
│ ├── Dockerfile
│ ├── go.mod
│ └── main.go
├── python-http
│ ├── .devcontainer.json
│ ├── Dockerfile
│ └── app.py
└── ts-http
├── .devcontainer.json
├── Dockerfile
├── db.json
└── package.json
Example Python .devcontainer.json
{
"name": "Python Container",
"dockerComposeFile": ["../docker-compose.yaml"],
"service": "pythonapp",
"shutdownAction": "none",
"workspaceFolder": "/workspace/app",
"overrideCommand": true,
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": true,
"configureZshAsDefaultShell": true,
"installOhMyZsh": true,
"upgradePackages": true,
"username": "devcontainer",
"userUid": "automatic",
"userGid": "automatic"
}
}
}
Additional Resources
Refer to the example code at the following GitHub repository for a more comprehensive overview: dev-container-test.
Expected Behavior
The system should allow multiple dev containers to be built using the command palette similar to
devcontainer build go-http; devcontainer build python-http; devcontainer build ts-http
Additionally features should be built into every dev container not just one.
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.