问题
I am new in using Docker and I want to mount my project in a container to run it on a Virtual Host. First of all I installed the Docker Toolbox that works for Windows 10. I am using the Docker QuickStart Terminal as my CLI to work with. I tried to pull an image that I will use for my project and it was successfull.
Unfortunately when I try to mount my project I get this error.
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: invalid mode: /var/www/app/. See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.
And this is the command to mount the project on that specific image to create a container that I will run on.
docker run -d --name=cbpass_container -v C:\Users\me\Documents\cbpass\server:/var/www/app/ -P -p 5432:5432 -t -i
image/someimagename:dev
Is there any problem with my command? Appreciate if someone can help. Thanks in advance.
回答1:
Have you enabled the shared drives?
回答2:
try changing host path to : /C/Users/public/xxx
I test with OK with the following cmd (Windows 7):
docker run -p xxx:xxx --network=host -it -v /c/Users/Public/log:/var/log --rm --privileged registry.xxxxxx.xxxx.xxx
May this help you :)
回答3:
In docker for windows, you have options/settings to add a directory for sharing. I think that handles what I am going to describe.
In docker toolbox, we have VirtualBox running between our own machine and container. So when you are going to share a folder, you have to share it with Virtual Machine first, then you can share with container.
In VirtualBox, find your docker-machine (probably default), then in settings you can find Shared Folders. After adding your folder there, please pick a wise name for your folder. Then you will see that when you ssh your container in toolbox, you will see there is a folder in path "/your-folder-name". You can then use -v argument with that path.
来源:https://stackoverflow.com/questions/47091139/docker-mount-project-error-response-from-daemon-on-windows-10