Docker run -v does not work on Windows with docker-toolbox

When executing the following command from CoreOS VM, it works as expected:

docker run --rm -v $PWD:/data composer init

What he will do is initialize the composer.json file in the current working directory using the toner docker mapping as indicated. The docker container basically contains the installed php tool composer and launches this tool inside the / data folder of the container. Using mapping, it actually applies it to files on the host machine.

However, when I try to run this command on Windows using the Docker Toolbox, I get the following error.

 $ docker run --rm -v $PWD:/data composer --help invalid value "C:\\Users\\Marco;C:\\Program Files\\Git\\data" for flag -v: bad mount mode specified : \Program Files\Git\data See 'C:\ProgramData\Chocolatey\lib\docker\bin\docker.exe run --help'. 

What I notice here, although I'm in git-bash when I execute a command, still uses Windows paths. So, I tried the following (volume with quotes):

 $ "docker run --rm -v $PWD:/data composer --help" bash: docker run --rm -v /c/Users/Marco:/data composer --help: No such file or directory 

Now he can not find the directory.

I also tried without the $ PWD variable, but that doesn't matter.

Any ideas how to make this work on Windows?

+5
source share
2 answers

This should work: $ docker run --rm -v //c/Users/Marco:/data composer --help

+4
source

Try MSYS_NO_PATHCONV=1 docker run ...

Gitbash is trying to convert the path for other Windows commands.

0
source

Source: https://habr.com/ru/post/1235362/


All Articles