compose icon indicating copy to clipboard operation
compose copied to clipboard

windows linux subsystem (WSL) and incorrect absolute paths

Open ej3 opened this issue 9 years ago • 4 comments

Windows 10 (build 15063.11) running Xenial (16.04.2 LTS) with a docker (17.03) client attaching to the hyper-V docker-for-windows daemon (17.03.1).

In WSL running docker run -v c:/some/stuff/here:/var/is/now/here --rm bash ls /var/is/now/here will list the content of c:/some/stuff/here as expected. I don't think this will work if you try to run a volume from the WSL file system (I haven't tried that in awhile). but as long as the file is in the windows file system the volume seems to mount as expected - no problems.

When a relative path is specified within docker-compose.yml for a service

serviceName: volumes: -./some/path:/var/another/path

Compose generates the absolute path in collusion with the underlying WSL libraries to be something like: /mnt/c/Users/thedude/dev/some/path which docker ingests, and pukes when it tries to access anything in /mnt/c/... because /mnt/c/ is an alias that's only valid in the WSL environment. The windows daemon does not understand that /mnt/c === c:/.

The quick fix would be to make compose filter paths that start with /mnt/c and simply transform them to c:/ - but also may be a completely terrible idea.

ej3 avatar Apr 04 '17 07:04 ej3

I'm tempted to say this is a WSL issue moreso than a Compose one. If the call to os.path.abspath returns an invalid path, this is the system's responsibility - not the application's.

The quick fix would be to make compose filter paths that start with /mnt/c and simply transform them to c:/ - but also may be a completely terrible idea.

Considering /mnt/c/ is a valid path in UNIX systems, that would definitely be a no-go.

shin- avatar Apr 04 '17 21:04 shin-

Thanks for the quick response, and more insight. I submitted an issue at Microsoft/BashOnWindows#1854 .

I feel like the facility is already there for things like windows interop, but I don't know that it's accessible unless I run the NT docker-compose binary from wsl (pretty weird thing to do).

In any case there are 100 paths around the issue - it's interesting, but I agree that it's not a compose problem. I'd close the issue, but I'll leave that up to you.

ej3 avatar Apr 04 '17 22:04 ej3

Looks like you found a workaround in https://github.com/Microsoft/BashOnWindows/issues/1854 - I'll close this as a result :+1:

shin- avatar Apr 20 '17 00:04 shin-

In latest update 1803 is already a solution within WSL configuration.

Check this: https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly#running-windows-10-1803

DzeryCZ avatar Jun 12 '18 14:06 DzeryCZ