Reputation: 1729
What's the difference between these two docker run commands and why one is working and the other does not.
Working Command
docker run --publish=7474:7474 --volume=$HOME/neo4j_test/data:/data neo4j
Not Working
docker run --publish=7474:7474 --volume=C:/Users/USERNAME/neo4j_test/data:/data neoj
docker run --publish=7474:7474 --volume=C:\Users\USERNAME\neo4j_test\data:/data neo4j
Error for these commands
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: Invalid bind mount spec "C:UsersUSERNAMEneo4j_testdata:/data": invalid mode: /data. See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.
In the non-working commands, I just replaced $HOME
with the absolute path for my user profile folder C:/Users/USERNAME
UPDATE
I did inspect the value for $HOME
by executing echo $HOME
on Windows Powershell. And it is in fact C:\Users\USERNAME
. I also did look at the link that @Titouan Freville has commented. So I used the command
docker run --publish=7474:7474 --volume=/c/Users/USERNAME/neo4j_test/data:/data neo4j
isntead of
docker run --publish=7474:7474 --volume=C:/Users/USERNAME/neo4j_test/data:/data neoj
and it is working now. Right now I'm just wondering where the transformation of $HOME
from C:\Users\USERNAME
to /c/Users/USERNAME
happens
Upvotes: 27
Views: 67448
Reputation: 3452
For anyone still having this problem with Docker-for-Windows, here are the 2 solutions that work:
with MSYS_NO_PATHCONV=1
In full: MSYS_NO_PATHCONV=1 docker run -v /c/path:/path
//
at the beginning
In full: docker run -v //c/path:/path
Source: https://github.com/moby/moby/issues/24029#issuecomment-250412919
Upvotes: 32
Reputation: 477
To close the subject. Here is the solution ;) docker toolbox mount file on windows
Also, the interpolation of $HOME by docker on windows have to be compatible with it, so it should transform it by himself when you call it in docker command.
Upvotes: 10