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.yml
file.
Using adocker-compose
file 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 -d
will 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)
Pyetro notes in the comments:
In Windows, a double slash is needed at the beginning of the path to indicate the working directory.
Just to work with short path use like this:docker run -v //$(PWD)/folder:/folder ...
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).