Description
What happened?
I built a devcontainer image using devcontainers/ci github actions, which embeds the information from the devcontainer.json
used to build the image in the image.metadata
label.
The image is here: https://github.com/mc-rtc/mc-rtc-superbuild/pkgs/container/mc-rtc-superbuild/414550884?tag=jammy
It was built from a devcontainer.json
containing the following mounts
property:
{
"mounts": [
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/docker-ws/mc-rtc-superbuild-jammy,target=/home/vscode/workspace,type=bind,consistency=cached"
],
...
}
which indeed appears in image.metadata
{
"devcontainer.metadata": "[ {\"id\":\"ghcr.io/devcontainers/features/common-utils\"}, {\"id\":\"ghcr.io/georgofenbeck/features/lazygit-linuxbinary:1\"}, {\"id\":\"ghcr.io/devcontainers/features/git\",\"customizations\":{\"vscode\":{\"settings\":{\"github.copilot.chat.codeGeneration.instructions\":[{\"text\":\"This dev container includes an up-to-date version of Git, built from source as needed, pre-installed and available on the `PATH`.\"}]}}}}, {\"id\":\"ghcr.io/devcontainers/features/node:1\",\"customizations\":{\"vscode\":{\"extensions\":[\"dbaeumer.vscode-eslint\"],\"settings\":{\"github.copilot.chat.codeGeneration.instructions\":[{\"text\":\"This dev container includes `node`, `npm` and `eslint` pre-installed and available on the `PATH` for Node.js and JavaScript development.\"}]}}}}, {\"id\":\"ghcr.io/devcontainers/features/github-cli\",\"customizations\":{\"vscode\":{\"settings\":{\"github.copilot.chat.codeGeneration.instructions\":[{\"text\":\"This dev container includes the GitHub CLI (`gh`), which is pre-installed and available on the `PATH`. IMPORTANT: `gh api -f` does not support object values, use multiple `-f` flags with hierarchical keys and string values instead. When using GitHub actions `actions/upload-artifact` or `actions/download-artifact` use v4 or later.\"}]}}}}, {\"id\":\"ghcr.io/duduribeiro/devcontainer-features/neovim:1.0.1\"}, {\"postCreateCommand\":\"~/superbuild/.devcontainer/setupShell.sh\",\"customizations\":{\"vscode\":{\"extensions\":[\"twxs.cmake\",\"ms-vscode.cmake-tools\",\"josetr.cmake-language-support-vscode\",\"ms-vscode.cpptools\",\"ms-vscode.docker\",\"ms-vscode.cpptools-extension-pack\",\"ms-vscode-remote.remote-containers\",\"ms-python.python\",\"GitHub.vscode-github-actions\"]}},\"mounts\":[\"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached\",\"source=${localEnv:HOME}${localEnv:USERPROFILE}/docker-ws/mc-rtc-superbuild-jammy,target=/home/vscode/workspace,type=bind,consistency=cached\"],\"containerEnv\":{\"DISPLAY\":\"${localEnv:DISPLAY}\"},\"remoteUser\":\"vscode\"} ]"
}
Locally I am using a devcontainer.json
that uses this image with a different mount point:
{
"name": "hugo-superbuild-jammy",
"image": "ghcr.io/mc-rtc/mc-rtc-superbuild:jammy",
"mounts": [
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/docker-ws/hugo-superbuild-jammy,target=/home/vscode/workspace,type=bind,consistency=cached"
],
...
}
According to the spec:
Collected list of all mountpoints. Conflicts: Last source wins.
I would expect my mount point to be (last source wins)
"mounts": [
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/docker-ws/hugo-superbuild-jammy,target=/home/vscode/workspace,type=bind,consistency=cached"
],
However when running devpod up
it becomes:
{
"mounts":[{"type":"bind","source":"/tmp/.X11-unix","target":"/tmp/.X11-unix","other":["consistency=cached"]},{"type":"bind","source":"${localEnv:HOME}${localEnv:USERPROFILE}/docker-ws/mc-rtc-superbuild-jammy","target":"/home/vscode/workspace","other":["consistency=cached"]}]},{"remoteUser":"vscode","containerEnv":{"DISPLAY":"${localEnv:DISPLAY}","UBUNTU_VERSION":"jammy"},"mounts":[{"type":"bind","source":"/tmp/.X11-unix","target":"/tmp/.X11-unix","other":["consistency=cached"]},{"type":"bind","source":"${localEnv:HOME}${localEnv:USERPROFILE}/docker-ws/hugo-superbuild-jammy","target":"/home/vscode/workspace","other":["consistency=cached"]}]}]
}
The full generated docker command when running my devcontainer becomes:
18:31:34 debug Running docker command: docker run --sig-proxy=false --mount type=bind,src=/home/arnaud/devel/hugo,dst=/home/vscode/superbuild -u root -e DEVPOD=true -e REMOTE_CONTAINERS=true -e DEVPOD_WORKSPACE_ID=hugo-polytope -e DEVPOD_WORKSPACE_UID=default-hu-f6408 -e DISPLAY=:1 -e UBUNTU_VERSION=jammy --mount type=bind,src=/home/arnaud/docker-ws/mc-rtc-superbuild-jammy,dst=/home/vscode/workspace,consistency=cached --mount type=bind,src=/tmp/.X11-unix,dst=/tmp/.X11-unix,consistency=cached -l dev.containers.id=default-hu-f6408 -l devcontainer.metadata=[{"id":"ghcr.io/devcontainers/features/common-utils"},{"id":"ghcr.io/georgofenbeck/features/lazygit-linuxbinary:1"},{"id":"ghcr.io/devcontainers/features/git","customizations":{"vscode":{"settings":{"github.copilot.chat.codeGeneration.instructions":[{"text":"This dev container includes an up-to-date version of Git, built from source as needed, pre-installed and available on the `PATH`."}]}}}},{"id":"ghcr.io/devcontainers/features/node:1","customizations":{"vscode":{"extensions":["dbaeumer.vscode-eslint"],"settings":{"github.copilot.chat.codeGeneration.instructions":[{"text":"This dev container includes `node`, `npm` and `eslint` pre-installed and available on the `PATH` for Node.js and JavaScript development."}]}}}},{"id":"ghcr.io/devcontainers/features/github-cli","customizations":{"vscode":{"settings":{"github.copilot.chat.codeGeneration.instructions":[{"text":"This dev container includes the GitHub CLI (`gh`), which is pre-installed and available on the `PATH`. IMPORTANT: `gh api -f` does not support object values, use multiple `-f` flags with hierarchical keys and string values instead. When using GitHub actions `actions/upload-artifact` or `actions/download-artifact` use v4 or later."}]}}}},{"id":"ghcr.io/duduribeiro/devcontainer-features/neovim:1.0.1"},{"remoteUser":"vscode","postCreateCommand":{"":["~/superbuild/.devcontainer/setupShell.sh"]},"customizations":{"vscode":{"extensions":["twxs.cmake","ms-vscode.cmake-tools","josetr.cmake-language-support-vscode","ms-vscode.cpptools","ms-vscode.docker","ms-vscode.cpptools-extension-pack","ms-vscode-remote.remote-containers","ms-python.python","GitHub.vscode-github-actions"]}},"containerEnv":{"DISPLAY":"${localEnv:DISPLAY}"},"mounts":[{"type":"bind","source":"/tmp/.X11-unix","target":"/tmp/.X11-unix","other":["consistency=cached"]},{"type":"bind","source":"${localEnv:HOME}${localEnv:USERPROFILE}/docker-ws/mc-rtc-superbuild-jammy","target":"/home/vscode/workspace","other":["consistency=cached"]}]},{"remoteUser":"vscode","containerEnv":{"DISPLAY":"${localEnv:DISPLAY}","UBUNTU_VERSION":"jammy"},"mounts":[{"type":"bind","source":"/tmp/.X11-unix","target":"/tmp/.X11-unix","other":["consistency=cached"]},{"type":"bind","source":"${localEnv:HOME}${localEnv:USERPROFILE}/docker-ws/hugo-superbuild-jammy","target":"/home/vscode/workspace","other":["consistency=cached"]}]}] -l devpod.user=root --network=host --cap-add=sys_nice --security-opt seccomp=unconfined -d --entrypoint /bin/sh ghcr.io/mc-rtc/mc-rtc-superbuild:jammy -c echo Container started
This has the wrong mount point: it uses the one from the built image
--mount type=bind,src=/home/arnaud/docker-ws/mc-rtc-superbuild-jammy,dst=/home/vscode/workspace,consistency=cached
Instead I would have expected the path from the local devcontainer.json file
--mount type=bind,src=/home/arnaud/docker-ws/hugo-superbuild-jammy,dst=/home/vscode/workspace,consistency=cached
What did you expect to happen instead?
It should honor the latest specified "mount" point. I believe the issue is somewhere here:
devpod/pkg/devcontainer/config/merge.go
Line 127 in e817923
Local Environment:
- DevPod Version: v0.6.15
- Operating System: Ubuntu 22.04
- ARCH of the OS: AMD64
DevPod Provider:
- Local/remote provider: docker