- This is a shameless TL;DR version of boot2docker together with VirtualBox Guest Additions by Mattes
- See boot2docker/pull/284 for the official discussion.
Install latest version of boot2docker:
$ boot2docker delete ; boot2docker download ; boot2docker up
Download the boot2docker.iso with virtual box additions: boot2docker-v1.0.1-virtualbox-guest-additions-v4.3.12.iso:
$ wget http://static.dockerfiles.io/boot2docker-v1.0.1-virtualbox-guest-additions-v4.3.12.iso
Replace the old one at ~/.boot2docker/boot2docker.iso:
$ boot2docker stop
$ mv ~/.boot2docker/boot2docker.iso ~/.boot2docker/boot2docker.iso.backup
$ mv boot2docker-v1.0.1-virtualbox-guest-additions-v4.3.12.iso ~/.boot2docker/boot2docker.iso
$ boot2docker init
Let VirtualBox know, which path you want to mount:
$ VBoxManage sharedfolder add boot2docker-vm -name home -hostpath /Users --automount
Verify that the VM has mounted the /Users folder:
$ boot2docker up
$ boot2docker ssh "ls /Users"
Shared
mdl
Now you can mount any files from /Users into your Docker containers:
$ docker run -i -t -v /Users/mattes/project1:/data/project1 ubuntu /bin/bash
Don't forget to enable port forwarding for the appropriate ports:
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port3000,tcp,,3000,,3000";
docker-osx doesn't do any port forwarding in the Vagrantfile, so I take it that this command:
isn't necessary unless you want to be able to access localhost on certain ports and get directed to the docker VM. Right?