Multiple services in docker-compose with separate devcontainer.json files - only one service gets features installed
维护者通常 1 天内回复
@v-Kaniska244 已经在做这个了。
开始于 2026年4月27日。
评估
这个 Issue 还没有评估数据。
描述
Bug Report
Description
When using a single docker-compose.yml file with multiple services, each having their own separate .devcontainer/devcontainer.json files, only one service gets its features installed. The service that is started first gets its features correctly installed, while the second service is missing its configured features.
Additionally, using devcontainer up on one service causes the other service's container to be rebuilt, even though they should be independent.
Root Cause
The devcontainer CLI generates a single temporary containerFeatures override file for the entire docker-compose project, instead of generating per-service override files. This temporary file only contains the configuration for the service that was most recently processed, causing the other service's features to be ignored.
Evidence
1. Both containers reference the same temporary file
Container labels show both containers pointing to the identical temporary override file:
com.docker.compose.project.config_files: /var/folders/.../docker-compose.devcontainer.containerFeatures-1777044430151-115a3236-0fb3-4ab5-bdb6-d1baa4463613.yml
2. Temporary file only contains one service's configuration
The temporary override file (docker-compose.devcontainer.containerFeatures-*.yml) only contains configuration for the reportify service:
services:
'reportify':
entrypoint: ["/bin/sh", "-c", "echo Container started\n..."]
labels:
- 'devcontainer.local_folder=/Users/shihaonan/.devcontainer/xiaobangtouzi/reportify'
- 'devcontainer.config_file=/Users/shihaonan/.devcontainer/xiaobangtouzi/reportify/.devcontainer/devcontainer.json'
The duplik service configuration is completely missing from this file.
3. Container metadata confirms missing features
When inspecting the containers:
- reportify container:
devcontainer.metadatalabel includes Python feature - duplik container:
devcontainer.metadatalabel is missing the Python feature
When executing commands inside containers:
- reportify container: Has Python 3.11.15 installed ✓
- duplik container: No Python installed ✗
Configuration
docker-compose.yml (shared by both services)
services:
duplik:
build:
context: ./duplik
dockerfile: Dockerfile
volumes:
- src:/workspaces
command: sleep infinity
reportify:
build:
context: ./reportify
dockerfile: Dockerfile
volumes:
- src:/workspaces
command: sleep infinity
volumes:
src:
duplik/.devcontainer/devcontainer.json
{
"name": "Duplik Development",
"dockerComposeFile": "../../docker-compose.yml",
"service": "duplik",
"workspaceFolder": "/workspaces/duplik",
"features": {
"ghcr.io/devcontainers/features/python:1": {
"version": "3.10"
}
},
"onCreateCommand": "/root/.devcontainer/init.sh",
"postStartCommand": "cd ~/.config/nvim && git pull --rebase",
"overrideCommand": false,
"runServices": [],
"remoteUser": "root"
}
reportify/.devcontainer/devcontainer.json
{
"name": "Reportify Development",
"dockerComposeFile": "../../docker-compose.yml",
"service": "reportify",
"workspaceFolder": "/workspaces/reportify",
"features": {
"ghcr.io/devcontainers/features/python:1": {
"version": "3.11"
},
"ghcr.io/devcontainers-extra/features/poetry:2": {}
},
"onCreateCommand": "/root/.devcontainer/init.sh",
"postStartCommand": "cd ~/.config/nvim && git pull --rebase",
"overrideCommand": false,
"runServices": [],
"remoteUser": "root"
}
Expected Behavior
According to VS Code Dev Containers documentation, it is officially supported to have:
- A single
docker-compose.ymlfile - Multiple services
- Each service with its own separate
.devcontainer/devcontainer.jsonfile
Expected: Each service should have its own features installed independently, and starting one service should not cause the other to rebuild.
Actual Behavior
- Only one service gets its features installed (the one that was processed first/last by the CLI)
- The other service is missing all configured features
- Using
devcontainer upon one service causes the other service's container to be rebuilt
Environment
- OS: macOS (Darwin 25.4.0)
- Docker Desktop latest
- 主要语言
- TypeScript
- 星标
- 3k
- 派生
- 463
- 平均合并
- 13 小时 28 分钟
- 30 天内合并 PR
- 2
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
devcontainers/cli 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 92/100
devcontainers/cli#1203 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 68/100
devcontainers/cli#1178 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 68/100
devcontainers/cli#1317 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
devcontainers/cli#1308 ·
维护者通常 1 天内回复
-
build rejects valid tag@digest image references during registry inspection可能已有人在做 @v-Kaniska244 于 9 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 78/100
devcontainers/cli#1307 · 2 条评论 · 1 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
查看 devcontainers/cli 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
modelcontextprotocol/ext-skills#156 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
MystenLabs/MemWal#1104 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
Effect-TS/effect#8728 · 1 条评论 ·
维护者通常 1 天内回复
-
account-pool bug
难度 2/5 1-3 小时 新手友好度 76/100
lidge-jun/opencodex#6571 · 1 条评论 ·
维护者通常 1 天内回复
-
check:passed streams:add
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复