microsoft / microsoft/vscode-remote-release

Docker-Compose Dev Container Setup Cannot use multi window dev-containers and use .devcontainer.json features

Open
#8,744 2 comments 1 reaction 1 assignee View on GitHub

@chrmarti is already working on this.

Since Jul 27, 2023.

containers feature-request
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

  1. Set up multiple Docker files.
  2. Create .devcontainer.json files as per the instructions at Advanced Containers - Connect Multiple Containers.
  3. Add features as to the .devcontainer.json
  4. Initiate connection via Docker Compose following steps to open different sub-folders in containers.
  5. The containers will open, but only one .devcontainer.json file will be acknowledged via the command pallet at a time.
  6. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.