You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If specifying mounts in devcontainer.json and trying to mount the same volume in different locations, you get a deserialization error.
[2024-05-08T20:39:45.846Z] parsing /tmp/devcontainercli-root/docker-compose/docker-compose.devcontainer.containerFeatures-1715200785780-516d96c0-3c67-479f-b191-c3c3d323c3c3.yml: yaml: unmarshal errors:
line 28: mapping key "build-obj" already defined at line 26
However this works without problems if you specify the volumes in docker-compose.yml.
The error you're seeing is due to the way the devcontainer.json file is being converted to a Docker Compose file. When you specify the same volume multiple times in the mounts field of devcontainer.json, it's being converted to a Docker Compose file with duplicate volume definitions, which is not valid.
In Docker Compose, you can mount the same volume to multiple locations in a container, as you've shown in your docker-compose.yml example. However, when specifying mounts in devcontainer.json, each mount needs to have a unique source.
A workaround for this issue is to define the mounts directly in a docker-compose.yml file instead of devcontainer.json. You can then reference this Docker Compose file in your devcontainer.json:
If specifying mounts in
devcontainer.json
and trying to mount the same volume in different locations, you get a deserialization error.However this works without problems if you specify the volumes in
docker-compose.yml
.If a unique key is needed, the target and not the source of the mount should be used.
Log fragment
The text was updated successfully, but these errors were encountered: