moby: Problem with -v shared folders in 1.6
System: Window 7/64
With:
Boot2Docker version 1.5.0, build master : a66bce5 - Tue Feb 10 23:31:27 UTC 2015
docker run \
-v /c/Users/Dieter/Documents/Gastrobase:/home/shiny/Gastrobase \
hello-world
is a valid command. This is a simplified and function-less test version, see below for the “real” one. Note that /Dieter is a valid user, please replace for testing.
With
$ docker version
Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): windows/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 4749651
OS/Arch (server): linux/amd64
I could not find out how to define the path in -v; I tried several of the variants mentioned in the docs of 1.5 on shared folders.
$ docker run \
> -v /c/Users/Dieter/Documents/Gastrobase:/home/shiny/Gastrobase \
> hello-world
invalid value "c:\\Users\\Dieter\\Documents\\Gastrobase;C:\\Program Files (x86)\\Git\\home\\shiny\\Gastrobase" for flag -v: \Users\Dieter\Documents\Ga
strobase;C:\Program Files (x86)\Git\home\shiny\Gastrobase is not an absolute path
See 'c:\Program Files\Boot2Docker for Windows\docker.exe run --help'.
---- Real application -------------
docker run --restart=always --name gastrobase -d -p 3838:3838 \
-v /c/Users/Dieter/Documents/Gastrobase:/home/shiny/Gastrobase \
dmenne/gastro-docker
Dieter@DIETERPC ~
$ docker run --restart=always --name gastrobase -d -p 3838:3838 \
> -v /c/Users/Dieter/Documents/Gastrobase:/home/shiny/Gastrobase \
> dmenne/gastro-docker
invalid value "c:\\Users\\Dieter\\Documents\\Gastrobase;C:\\Program Files (x86)\\Git\\home\\shiny\\Gastrobase" for flag -v: \Users\Dieter\Documents\Ga
strobase;C:\Program Files (x86)\Git\home\shiny\Gastrobase is not an absolute path
See 'c:\Program Files\Boot2Docker for Windows\docker.exe run --help'.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 35 (9 by maintainers)
Commits related to this issue
- Tentive fix for the problem with Docker's shared folders on Windows (see https://github.com/docker/docker/issues/12590). — committed to CampagneLaboratory/MetaR by manuelesimi 8 years ago
- Rebase vnext-compose (#1190) * d4mac, d4win stable 1.12.5 and beta 34 updates Signed-off-by: Victoria Bialas <victoria.bialas@docker.com> * fix punctuation typos (#949) Signed-off-by: Jie Lu... — committed to docker/docs by johndmulhausen 7 years ago
- Rebase vnext-compose (less a couple commits) onto master (#1196) * fix punctuation typos (#949) Signed-off-by: Jie Luo <luo612@zju.edu.cn> * fix the error of handing a and an (#953) * delete... — committed to docker/docs by deleted user 7 years ago
A hacky workaround for mysys is to use double leading slashes on the path:
@dmenne
If you’re using git bash on windows, msysgit converts paths like /c/users to c:\users (not something you want because the path inside the boot2docker VM is /c/Users)
Try surrounding -v value with single quotes like:
On cmd.exe/powershell you shouldn’t be having this problem. Does this solve the issue?
Update: (For people running into this while using git-for-windows’ flavour of msys) - I threw out the powershell script I was using earlier, and fixed the problem in the Makefile itself. I just exported
MSYS_NO_PATHCONV=1
for any tasks which used linux-style paths or usingpwd
.example:
Ref: https://github.com/git-for-windows/msys2-runtime/pull/11
@kumarharsh thank you. I fixed this by creating an bash script:
For everyone who still has a problem with mounting a folder on Windows. Make sure your drive letter is lowercase.
docker run -i -t -v /c/Users/Jakob/src:/mnt some_container
double // before win path works for me,thanks a lot:)
I figured out why the previous bug was happening: It was because my
pwd
was inD:\
drive, andD:\
drive is not mounted by default. To mount it, I followed the instructions given here: http://stackoverflow.com/a/32030385/630170Now, the issue is that using git / msys2’s bash makes it impossible to mount the D:\ volumes using either of these:
(with leading slash)
which gives this error:
cat: C:/Users/usr/AppData/Local/Temp/file: No such file or directory
or
(without leading slash) or (with single quotes) or (with double quotes)
which gives this error:
docker run -v //c/Users/brettp/app:/app
Worked!