On a Mac, how do you mount a volume to a Docker container?
On my linux box, this is easy. All I need to do is something like -v /src/webapp:/opt/webapp
when running the container. But Mac is different since I have to run boot2docker to run a VM in VirtualBox. I've tried running
boot2docker init
boot2docker up
boot2docker ssh # to poke around
boot2docker stop
VBoxManage sharedfolder add "boot2docker-vm" --name "Users" --hostpath /Users
boot2docker up
boot2docker ssh "sudo modprobe vboxsf"
but I get
modprobe: module vboxsf not found in modules.dep
If I ignore that and still try to mount on the VM like so
boot2docker ssh "sudo mkdir /test && sudo mount -t vboxsf Users /test"
I get
mount: mounting Users on /test failed: No such device
I feel like I'm missing something extremely simple, but I can't quite figure it out. Any help would be greatly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…