Docker toolbox: Is there a way to mount other fold

2019-01-24 12:34发布

问题:

I installed Docker toolbox 1.8.3 using VirtualBox 5.0.6 on Windows 7.

The default virtual machine created during startup of Docker Quickstart Terminal has one defined shared folder for c:\Users. Is it possible to persistently add other shared folders to this virtual machine e.g. mounting a d:\ drive on the host?

回答1:

The boot2docker README mentions

Alternatively, Boot2Docker includes the VirtualBox Guest Additions built in for the express purpose of using VirtualBox folder sharing.

The first of the following share names that exists (if any) will be automatically mounted at the location specified:

c/Users share at /c/Users
/c/Users share at /c/Users
c:/Users share at /c/Users

If some other path or share is desired, it can be mounted at run time by doing something like:

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

You can see more at VirtualBox / Guest Additions / Shared folders

From the command line, you can create shared folders using VBoxManage, as follows:

VBoxManage sharedfolder add "boot2docker-vm" --name "sharename" --hostpath "C:\test"