moby: Broken volume mounting under Windows

When running Docker (1.9) under Windows 8, attempting to mount a volume fails miserably:

$ docker run --entrypoint /bin/sh -it -v "/c/Path To My Repo:/myprogram" my_test
invalid value "C:\\Path To My Test\\;C:\\Program Files\\Git\\myprogram" for flag -v: bad mode specified: \Program Files\Git\myprogram
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

This is being run from the mingw prompt.

What am I doing wrong here?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 4
  • Comments: 32 (13 by maintainers)

Most upvoted comments

image This solves the problem

For a mingw bash shell, this is what docker toolbox adds (for example in bashrc) to stop mingw from corrupting the paths:

docker () {
  MSYS_NO_PATHCONV=1 docker.exe "$@"
}
export -f docker

I’m closing this issue because all issues reported here seem to either be an issue with mingw, docker toolbox / VirtualBox guest additions, or docker for windows; for issues with “docker for windows”, please use the dedicated issue tracker: https://github.com/docker/for-win/issues. For docker toolbox, please use https://github.com/docker/toolbox/issues.

This is not a bug in the “docker engine”, so there’s not a lot we can do in this repository, so I’ll close

i got it working with -v /c/Users/german/volumes:/german (note the capital U in users)

thanks @thaJeztah

@jhowardmsft That’s not the problem that we’re having here. Docker running on an ubuntu VM under Windows isn’t quite the same as installing the Docker Toolbox on Windows 😉

Which is where the problem is. Your docker client is just talking to the docker daemon inside your VM, mounting a linux path.

our problem is trying to mount a Windows path, like this:

Windows Machine
+-------------------------------+
|                               |
|  Docker VM (VirtualBox)       |
|  +-----------------------+    |
|  |                       |    |
|  | +------------------+  |    |
|  | | Docker Container |  |    |
|  | |                  |  |    |
|  | | /foo --,         |  |    |
|  | +--------|---------+  |    |
|  |        __|            |    |
|  |       /               |    |
|  |     ,/                |    |
|  |     V                 |    |
|  | /c/Path to/foo -,     |    |
|  +-----------------|-----+    |
|                   /           |
| C:\Path to\foo <-'            |
+-------------------------------+

But it doesn’t work. Miserably so 😦

I’m running version 1.12.0. docker run -it -v /c/Users/BAMF/codes/TNT:/app tnt_web /bin/bash This command did not give an error or warning, resulted in an empty /app directory in my container. I used the little whale icon in the taskbar to go to a settings/shared drives screen. I checked off the C drive and clicked Apply. It made me enter my windows credentials. I reset docker from the Settings menu after this change. Now the same command resulted in a properly mounted /app directory.

$ winpty docker run -v //c/Users/jon/coding/cah://cc joneaves/xxx invalid value "\\\\c\\Users\\jon\\coding\\cah:\\cc" for flag -v: \cc is not an a bsolute path See 'docker run --help'.

Is the result.

From my (brief) understanding - the winpty command “should” fix all that escaping issues. I suspect it’s something more heinous happening under the covers.

@pewsey thanks for the detailed repro steps! I don’t have access to a windows machine, but wondering if adding a double slash helps;

winpty docker run -v //c/Users/jon/coding/cah://cc joneaves/xxx

I think that prevented some “magic” conversion