Mounting a Docker volume while being under a Windows host, has been a huge pain for me, and I could not get it to work.
Currently I got the following simple Dockerfi
It is possible the / is interpreted as an option by the CMD Windows shell.
Try first a docker-machine ssh default, in order to open an ssh session in your VM. From there try the docker run again: docker run -v /c/Users/phisch/dev/htdocs:/var/www phisch:dev
As commented by thaJeztah in issue 18290:
You could consider using docker-compose; docker-compose allows you to define bind-mounted volumes relative to the location of the
docker-compose.ymlfile.
Using adocker-composefile allows you to specify all options needed to run your containers in a single file, which makes it ideal for sharing between team members (ie, just rundocker-compose up -dwill start all containers for the project with the right options).
This comment mentions a&dding a second /:
docker run -v //c/Users/phisch/dev/htdocs:`/var/www` phisch:dev
Even in the docker toolbox msys shell session, there are issues (like issue 282)
After lengthy discussion, the issue was that /var/www had a folder in it.
Mounting /c/Users/phisch/dev/htdoc onto an empty folder does work, but might not give the expected result, as the default CMD apache2-foreground might still serve its content based on /var/www (which would not have htdocs content if that htdocs is mounted onto another folder).