share windows folder (other than c/Users/) with docker container (using docker windows client)

安稳与你 提交于 2019-12-29 07:57:07

问题


Using docker client, is there a way to share a folder in windows with a docker container without having to first share the folder via the Virtual Box VM.

Have understood the need of having a double slash from this and this

Ran the following command from the docker client for windows

docker run -it -v //F/devfolder:/development/windev <imagename> <cmdname>

but when did a ls on /development/windev , it turned out it was empty.

I did not have any problem when I tried mounting the c/Users/username folder via the following command

docker run -it -v //c/Users/username/desktop:/development/windev <image> <command>

and the windev folder listed the contents as I would expect it to be

Tried sharing F/devFolder via Virtualbox GUI and gave full access but still the contents of the folder is not listed.

[I am not using boot2docker but docker-machine]

Is it not possible to share any other folder than the c/Users/ folder? If yes, anything else I need to do to ensure that I can see the contents of the mounted folder?


回答1:


Not only you have to mount it in your VirtualBox, but you also have to instruct, in your boot2docker TinyCore session that you want that folder visible (once you have done a docker-machine ssh yourMachine):

mount -t vboxsf -o uid=1000,gid=50 your-other-share-name /some/mount/location

I know that you are using docker-machine, and not boot2docker, yet docker-machine is still using a boot2docker.iso VM image based on TinyCore, so this command still applies.



来源:https://stackoverflow.com/questions/33934776/share-windows-folder-other-than-c-users-with-docker-container-using-docker-w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!