Compose: Relative path, .:/data, does not work on windows

Created on 2 Oct 2015  路  14Comments  路  Source: docker/compose

Due to us now using splitdrive in split_path_mapping it reads the .: as a drive, rather than a relative path.

areconfig kinbug

Most helpful comment

Hi @nemild

The issue you're hitting is not related to this one.

Docker machine only mounts /c/Users by default, but your using /d/, so the VM doesn't know about this path. The volume is being mounted by compose, but it's mounted to the VM path.

You need to mount another shared folder in virtualbox for this path, or use c:Users

There's some more context in #2198

All 14 comments

Awesome! What's my best option for pulling down the latest change and trying it out?

@atrauzzi if you hang tight, there should be a release candidate sooooooooooon :)

@mnowster :)

@dnephin Awesome, I'd love to help make more work for you guys! ;)

@mnowster, @dnephin Thanks for the fix, but we seem to have the same issue on docker-compose on Windows, even with docker-compose 1.5.1

I used the relative path for volume: .:/myapp, and that folder is empty when I do a docker-compose up.

If it makes it easier, the relative path doesn't really matter to me - I'm fine with absolute, but even if I replace the relative path with that (my pwd spits out: /d/mercurial/bch ) - it doesn't work. The myapp folder in the container is still empty.

More details:
OS: Windows 8.1
OS (uname -a): MINGW64_NT-6.3 2.1.0(0.288/5/3) 2015-6-28 x86_64 Msys
Docker 1.9.1, API version: 1.2.1, build a34a1d5, Git commit a34a1d5, Client OS/Arch: windows/amd64, Server OS/Arch: linux/amd64
Docker-Compose 1.5.1

Full docker-compose:

db:
  image: postgres
  ports:
    - "5432:5432"

web:
  build: .
  command: bash -c "(foreman run rails s -p 3000 -b '0.0.0.0' &) && ($$(npm bin)/gulp)"
  volumes:
    - .:/myapp
  ports:
    - "3000:3000"
    - "3001:3001"
    - "3002:3002"
  links:
    - db

The docker inspect output is here

Hi @nemild

The issue you're hitting is not related to this one.

Docker machine only mounts /c/Users by default, but your using /d/, so the VM doesn't know about this path. The volume is being mounted by compose, but it's mounted to the VM path.

You need to mount another shared folder in virtualbox for this path, or use c:Users

There's some more context in #2198

Hi @dnephin,

Thanks for the quick reply! We switched over to the c:\users folder and I verified that it was mounted on the docker-machine side (by sshing in, it's mounted at /c/Users/). We still get the error of a file not found, and tried relative and absolute paths in the docker-compose.yml. For the absolute path, I tried both lowercase and capital 'U' for Users (on the Windows side, it seems to be lower case, on the Linux Docker-Machine VM side, upper case). I did not try the c:\users\ representation. It looks like the relative error is fixed in 1.5.1, so is this something else?

The docker-compose.yml is as before, but we tested with the relative path and the two absolute paths (with and without the uppercase U). The Dockerfile works fine with the ADD for this folder, it's just the docker-compose.

Finally, how does one easily debug on Windows, when you can't use interactive mode? On a Mac, we would do a docker-compose run web ls to quickly shell in and see the current folder.

The latest docker inspect is here.

(I'm happy to open a new issue if you prefer)

Ok, I'm pretty sure it needs to be uppercase Users (the paste has lowercase).

One thing I noticed is there seem to be some unicode escaped characters in the command \u0026, do you know what those are?

Could you include a copy/pate of the command (with --verbose) that you ran and the output with the error?

Thanks again for the quick reply. Those \u0026 are ampersands, they seem ok to view with vim on the Windows box (and were originally created on Mac) - for now I'll remove them. Is that a Windows to Linux character mapping issue? Will also use the uppercase of Users (had used that in a previous run) - on the Windows side, the path is shown in all lowercase.

Here's the updated docker-compose.yml:

db:
  image: postgres
  ports:
    - "5432:5432"

web:
  build: .
  command: bash -c "foreman run rails s -p 3000 -b '0.0.0.0'"
  volumes:
    - /c/Users/ochekrigin/bch:/myapp
  ports:
    - "3000:3000"
    - "3001:3001"
    - "3002:3002"
  links:
    - db

(Going to assume no leading slash needed on the localhost path)

I'll include the --verbose paste within 24 hours.

@nemild commented 20 days ago :)

I'll include the --verbose paste within 24 hours.

I don't know if it's right that we should be required to put platform specific path structures in our compose files. If I tried using @nemild's compose file above on linux or OSX, it'd barf. /c doesn't exist on any normal Unix system.

You don't need to use absolute paths. If the compose file had relative paths it would work fine

Bom encontro

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dimsav picture dimsav  路  3Comments

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  3Comments

DhairyashilBhosale picture DhairyashilBhosale  路  3Comments

davidbarratt picture davidbarratt  路  3Comments

CrimsonGlory picture CrimsonGlory  路  3Comments