`devcontainer up --mount` rejects `type=image` and mount options such as `subpath`
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 功能
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- docker, docker-compose, typescript
研究方向
Trace how the --mount flag is validated and converted, then compare it with how string mounts from devcontainer.json reach the runtime. Check the Docker Compose path, where mounts use short syntax, and define a clear rejection for unsupported mount forms there. Done means runtime string mounts are passed through for supported runtimes, existing bind/volume behavior remains covered, and the linked pull request is reviewed for overlap.
由索引模型根據 Issue 內容生成。
描述
What I want to do
I keep my personal tools (neovim, Claude Code) in a Nix-built OCI image and mount its /nix read-only into a team's dev container with an image mount. The team's devcontainer.json stays untouched, so the mount has to come from the command line:
devcontainer up --docker-path podman --workspace-folder . \
--mount "type=image,source=localhost/devtools:latest,target=/nix,subpath=/nix"
Podman (since 5.1) and Docker Engine (since 28, with the containerd image store) support --mount type=image. Docker spells the option image-subpath instead of subpath.
What happens
The CLI exits with:
Unmatched argument format: mount must match type=<bind|volume>,source=<source>,target=<target>[,external=<true|false>]
The same string works as an entry in mounts in devcontainer.json. The CLI passes string mounts to podman run verbatim, and with --log-level trace I see:
podman run ... --mount type=image,source=localhost/devtools:latest,target=/nix,subpath=/nix ...
Inside the container, /nix is a read-only overlay, and nvim --version and claude --version run from it. So the runtime handles the mount fine; only the --mount flag refuses it.
Why
In 0.89.0 the flag goes through two steps:
- A fixed regex validates it:
/^type=(bind|volume),source=([^,]+),target=([^,]+)(?:,external=(true|false))?$/. Any other type or option fails, includingreadonly. - The value is parsed into a mount object, and the object is serialized back as
type=...,src=...,dst=.... Options outside these three fields would be lost even if the regex allowed them.
The object form follows the spec's Mount schema (type is bind or volume, additionalProperties: false).
Proposal
When the --mount value does not match the bind/volume form, pass it to the container runtime as a string, the same way string entries in devcontainer.json mounts are handled today. The bind/volume parsing and external= keep working as now.
That covers type=image, subpath / image-subpath, readonly, volume-subpath, tmpfs and future runtime options without the CLI having to know each one. The runtime reports an invalid string itself.
For Docker Compose configs the string cannot be passed through as-is, since mounts are converted to the short source:target syntax there. Rejecting a non-bind/volume --mount with a clear error on the Compose path would be enough.
Workaround
--override-config with a full copy of the team's devcontainer.json plus the string mount. The copy has to be regenerated whenever the team changes their file, because --override-config replaces the config instead of merging it.
Environment
- @devcontainers/cli 0.89.0
- Podman 6.1.4, rootless, Debian 13 (Linux 6.12, x86_64)
Related
- devcontainers/spec#781: the Feature
Mountschema rejects--mountoptions such asvolume-subpath - devcontainers/spec#511: no way to declare a read-only mount in object form
- devcontainers/cli#881 and devcontainers/cli#1314:
readonlyis dropped when mounts are converted
- 主要語言
- TypeScript
- 星號
- 3k
- 分支
- 473
- 平均合併
- 10 小時 31 分鐘
- 30 天內合併 PR
- 9
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
devcontainers/cli 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 82/100
devcontainers/cli#1325 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 92/100
devcontainers/cli#1203 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 68/100
devcontainers/cli#1178 · 1 則留言 ·
維護者通常 1 天內回覆
-
up hangs after compose up -d on a cold start (Node 26, Compose 5.6)可能已有人在做 @v-Kaniska244 今天認領。 未關閉
難度 4/5 3-5 天 新手友好度 48/100
devcontainers/cli#1354 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
SELinux labelling does not get disabled when using Podman machines可能重新可做 @darshpatel1052 於 7 天前認領,目前沒有進行中的 PR。 未關閉
難度 3/5 1-2 天 新手友好度 40/100
devcontainers/cli#1347 · 1 則留言 ·
維護者通常 1 天內回覆
查看 devcontainers/cli 的全部 Issue
相似的 Issue
-
e2e-failure ready-to-code
難度 2/5 1-3 小時 新手友好度 64/100
redhat-developer/rhdh-plugin-export-overlays#4733 · 1 則留言 ·
維護者通常 1 天內回覆
-
S-Needs triage
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 2 天內回覆
-
CLI Empathy needs triage
難度 2/5 1-3 小時 新手友好度 70/100
chromaui/chromatic-cli#1665 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
software-mansion/argent#1854 ·
維護者通常 1 天內回覆
-
難度 2/5 1 小時以內 新手友好度 65/100
nilbuild/developer-roadmap#10557 ·
維護者通常 1 天內回覆