share windows folder (other than c/Users/) with do

2020-02-12 10:45发布

问题:

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.