简体   繁体   中英

Mount a Virtualbox shared folder as a volume for Docker running on the guest OS

I have a Mac running OS X Sierra (host OS) and I'm using VirtualBox to run Xubuntu 16.04 (guest OS) and do all my development inside the guest OS. I have setup a shared folder using VirtualBox Guest Additions which mounts at /media/sf_Projects and is also symlinked from /home/me/Projects.

I have Docker installed in the Xubuntu guest OS and I am trying to run the app (Jupyter notebook) in the container that requires you to mount a data volume to map to one of its internal folders.

When I mount using the -v switch either using /media/sf_Projects or /home/me/Projects, the app gives me a 404 error saying that the path doesn't exist. I thought this was strange because it's the root directory as far as the app is concerned. So I tried to mount using the parent directory /media or /home/me instead, and it works fine and finds all the other sister folders except for the Projects folder. So it seems Docker cannot read my Projects path.

Is there something I'm doing wrong to mount my VirtualBox shared folder to Docker? Or is what I am doing impossible?

Basically, the problem is that the shared folder isn't mounted at VM boottime. To fix this, run sudo mount -t vboxsf sharename /path after VM boot.

There is an issue registered in Docker Machine Github about this problem. https://github.com/docker/machine/issues/1814

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM