-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running multiple devcontainers with docker-in-docker in parallel fails, need unique volume name #5679
Comments
@berndku You'll need to set a unique name for the volume name in the configuration if you are using two dev containers with docker-in-docker. @chrmarti, @joshspicer and I have discussed being able to generate a unique ID that can be referenced. If you use the same volume name with two in parallel they'll step on each other's data. |
Looked into adding Originally posted by @chrmarti in #5442 (comment) |
@chrmarti Wouldn't replacing those characters with a For that matter, we could convert the string to base64 if we had to. Automation here is really useful since it works by default in that case. |
I would The problem remains that the user might change the name without being aware that this will result in a different volume being used. We are computing an image name from the local folder path and could look into using that and/or add an option to the feature to allow for a custom volume name. |
@chrmarti True - it could be a general identifier. Largely a unique ID is needed and that's it. |
I want to point out that the same conflict exists for Minikube.
|
To close the loop, this is also a problem for the dev container features preview for docker-in-docker in particular as described in microsoft/vscode-dev-containers#1249. We'd want to be able to use this to give the volume a unique name to avoid it. |
@Chuxel - I've just hit this issue using the |
@stuartleeks No - tho IMHO, this is one of the things we have to have to "GA" features. //cc @edgonmsft @joshspicer @chrmarti @bamurtaugh |
Is there a decision on what identifier/name should be used for the volume name? I have a couple of features I'd like to create that also need this functionality 😄 |
This was raised as devcontainers/spec#62 in the dev container spec to zero in on a specific solution since it would apply to any tool implementing the specification. |
For those who can't wait, below is a workaround utilizing the fact that Docker Compose prepends directory name to named volumes: Assuming an existing
Edit {
// "name": ...,
"dockerComposeFile": "docker-compose.devcontainer.yml",
"service": "devcontainer",
"workspaceFolder": "/workspace",
"overrideCommand": true,
"features": {
"docker-in-docker": "latest",
// ...
},
// ...
} See |
This has been resolved in v2 of the docker-in-docker Feature for a bit now. Update your existing references as follows: "features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
} However, note that this will generate a new volume name, so the existing volume will no longer be used. If you need to keep your container contents around in one container, then stick with version 1 until you are ready to switch. |
A single devcontainer with docker-in-docker is running fine. If opening a second devcontainer with docker-in-docker on the same host in parallel, docker execution fails in the 2nd container.
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: