-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Relative paths for local volumes not working on windows #8922
Comments
Any reason you use this complex syntax, vs the common bind mount syntax: |
In my YAML these volumes are mounted in several different containers, hence having a central place where they are configured makes sense. Granted, this can also be achieved by using YAML anchors and aliases. Still, this is only a workaround and does not address the issue at its core. |
right, just asking because this is a pretty uncommon use of |
I also observe this on linux so it's not unique to windows.
|
Same case for OSX on M1 with:
|
This caused quite a bit of confusion for me. The use of relative paths in docker-compose is outlined in the "getting started" portion of the docs. I've only experienced this on Windows so far, and didn't have a problem with MacOS or WSL, but this issue complicates things for a cross-platform dev team wanting to use docker-compose. |
When will be or has been this issue fixed? |
This has been fixed by compose-spec/compose-go#332 |
It's not to be a joke but... it happens to me even worse... I don't even get an error in the Windows 11 terminal, this is my YML:
my php 81 Dockerfile where I execute several actions:
the problem: if I clear the docker desktop cache and run everything with a simple "up" from the terminal. the declared volume is not mounted. Log:
when inspection for the ssl files: Even removing "ro" and "rw" from the paths the problem persists... it is as if when mounting the volume, it ignores the existing files or those created by the Dockerfile ### What's going on here???? |
as you use a bind mount, files set by the Dockerfile will be overridden. Bind mount replace the Docker image filesystem folder by a unix mount to your configured source, so any previously existing file is hidden. |
some kind of mount point that keeps all the files: files created in the Dockerfile, file previously coming from the FS of the Host OS? Otherwise I don't see a way to share the files in the same place for two containers and the OS Host. |
Description
On Windows, using Docker Compose V2, volumes specified using a relative path are not correctly mounted.
Steps to reproduce the issue:
demo-volume
next to thedocker-compose.yml
docker compose up
Describe the results you received:
Mounting the volume fails with the error
Error response from daemon: error while mounting volume '/var/lib/docker/volumes/tinkerbox_demo_volume/_data': failed to mount local volume: mount demo-volume:/var/lib/docker/volumes/tinkerbox_demo_volume/_data, flags: 0x1000: no such file or directory
Describe the results you expected:
Volume is mounted correctly inside the docker container.
Additional information you deem important (e.g. issue happens only occasionally):
Using an absolute path, the volume is mounted as expected.
As opposed to Docker Compose V1, Docker Compose V2 on Windows does not resolve relative paths into absolute paths.
Using Docker Compose V1:
Using Docker Compose V2:
Output of
docker compose version
:Output of
docker info
:Additional environment details:
Host OS: Windows 10, Version 20H2, Build 19042.1288
The text was updated successfully, but these errors were encountered: