-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Docker Compose V2 with Docker Desktop on Windows / WSL2 gives "/mnt/c not a shared mount" error #8558
Comments
This seems to happen when the volumes are specified with trailing slashes. Specifically, this Compose file doesn't work with Compose v2: version: "3"
services:
redis:
image: redis
volumes:
- ./data/:/data/ But this one does: version: "3"
services:
redis:
image: redis
volumes:
- ./data:/data And the latter works fine with Compose v1. Until it gets fixed, as a workaround, you can remove the trailing slashes from your Compose file, or run the Compose file with Compose v1 (on my WSL install, I can run |
Extra info: on Linux, there is a slightly different (perhaps related) bug. When trying to bind-mount a local directory, if the directory doesn't exist, we get the following error message:
This is with version: "3"
services:
redis:
image: redis
volumes:
- ./data/:/data/ Now, the funny thing is that if you run it with Compose v1, it works, and creates the directory; and after the directory is created, it will work on Compose v2. And running without the trailing slashes on Compose v2 will work even if the directory is not created (and it will create it). |
I can confirm that removing trailing slash in volumes fixed the issue |
Such an easy fix, ported the docker-compose yaml from my linux setup, didn't ran with the issue there. |
- 💥[Improvement] Fail on incorrect image name argument in `images build/pull/push/printtag` commands. - [Bugfix] Remove trailing slashes in docker-compose files for [compatibility with docker-compose v2 in WSL](docker/compose#8558). - [Improvement] `settheme` now works with preview domain. - [Feature] Allow specifying extra pip packages through config.yml.
Description
Docker Desktop updated and enabled the 'Use Docker Compose V2' experimental feature.
My previously-working docker-compose configuration, run from WSL2, sharing files in the Windows filesystem, gives errors like:
Error response from daemon: path /mnt/c/path/to/dir is mounted on /mnt/c but it is not a shared mount.
Disabling the experimental feature: Use Docker Compose V2, it works fine.
Steps to reproduce the issue:
docker-compose up
Describe the results you received:
As expected,
docker compose up
does the same without Use Docker Compose V2 enabled:Describe the results you expected:
Without Use Docker Compose V2, it runs as expected:
Output of
docker-compose --version
:Output of
docker version
:Output of
docker context show
:Output of
docker info
:The text was updated successfully, but these errors were encountered: