11

I'm running docker 1.6 and boot2docker on a Windows 8.1 box. When I use the Boot2Docker Start shortcut, it takes me to a cygwin bash prompt where I can run docker commands natively.

I'm having trouble mounting a directory from my users folder. I've tried:

$ docker run -d --name abe -v $APPDATA/Bitcoin:/datadir poliver/bitcoin-abe

I get the error:

invalid value "C:\\Users\\someone\\AppData\\Roaming/Bitcoin:/datadir"
for flag -v: \Users\someone\AppData\Roaming/Bitcoin:/datadir 
is not an absolute path 
See 'c:\Program Files\Boot2DockeForWindows\docker.exe run --help'.

I get the same results when I call it these ways:

$ docker run -d --name abe -v "$APPDATA/Bitcoin":/datadir poliver/bitcoin-abe
$ docker run -d --name abe -v "/c/users/someone/AppData/Roaming/Bitcoin":/datadir poliver/bitcoin-abe
$ docker run -d --name abe -v ~/AppData/Roaming/Bitcoin:/datadir poliver/bitcoin-abe

I've also tried:

$ docker run -d --name abe -v ~/APPDATA/Bitcoin:/datadir poliver/bitcoin-abe

And I've gotten the error:

FATA[0000] Error response from daemon: cannot bind mount volume: ~\AppData\Bitcoin volume paths must be absolute.

It seems like cygwin bash is replacing / with \ and then docker parses the argument passed to -v and can't accept it.

  • On my boot2docker installation, the command "ls /c/Users" lists my Windows 8.1 C:\Users folder. Do you need to mount other locations? – Wilson Gibbins Apr 19 '15 at 21:14
  • I can certainly see /c/Users from the boot2docker linux VM (the host). But I need the poliver/bitcoin-abe container to mount a specific folder from /c/Users at the /datadir mount point on the container. – Paul Oliver Apr 20 '15 at 19:42
  • I also seem to experience the same problem unable to mount a host folder. $ docker run -d -v /c/Users/310145787/Desktop/mongo:/data/db mongo invalid value "c:\\Users\\310145787\\Desktop\\mongo;C:\\Program Files (x86)\\Git\\data\\db" for flag -v: \Users\310145787\Desktop\mongo;C:\Program Files (x86)\Git\data\db is not an absolute path – Marco Apr 22 '15 at 11:13
  • Did you get a solution to your problem? – Marco Apr 22 '15 at 11:13
  • Sorry Marco, no solution yet. :( – Paul Oliver Apr 22 '15 at 19:03
12

If you want to mount the $APPDATA on your Windows host machine to /datadir on the docker container, instead of the below command:

docker run -d --name abe -v $APPDATA/Bitcoin:/datadir poliver/bitcoin-abe

You can issue:

docker run -d --name abe -v //c/Users/YOUR_USER_NAME/$APPDATA/Bitcoin:/datadir poliver/bitcoin-abe

//c/Users/PATH_TO_DIR is the key here for Windows directory

Your $APPDATA Directory MUST reside on the /c/Users/Your_User_Name directory and it cannot reside on other places. (e.g. D:/$APPDATA on the D partition.)

6

see: https://github.com/docker/docker/issues/12590

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)

On cmd.exe/powershell you shouldn't be having this problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.