When discussing docker with fellow developers on macs, I often hear complaints about boot2docker doesn’t work as expected, or how the performance of shared volumes is slow.
I hear their complaints, after all I hit my head more than once against the same problems. Eventually I found a sweet solution that works for me, and has been battle tested by my coworkers too, a setup based on parallels, vagrant and boot2docker.
Using parallels gives us a less bug ridden NFS implementation, needed to avoid the performance problems of shared folders.
We use vagrant to tie everything up and we get a nice fast boot2docker that is a bit less magic than the default one, but also less opaque.
Vagrantfile, slightly tuned to also support the plain non-parallels boot2docker image.
VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "yungsang/boot2docker" config.vm.network "private_network", ip: ENV['BOOT2DOCKER_IP'] || "10.211.55.5" config.vm.provider "parallels" do |v, override| override.vm.box = "parallels/boot2docker" override.vm.network "private_network", type: "dhcp" end # http config.vm.network "forwarded_port", guest: 80, host: 80, auto_correct: true config.vm.network "forwarded_port", guest: 443, host: 443, auto_correct: true # rack config.vm.network "forwarded_port", guest: 9292, host: 9292, auto_correct: true config.vm.synced_folder "/Users/intinig/src", "/Users/intinig/src", type: "nfs", bsd__nfs_options: ["-maproot=0:0"], map_uid: 0, map_gid: 0 config.vm.synced_folder "/Users/intinig/src", "/src", type: "nfs", bsd__nfs_options: ["-maproot=0:0"], map_uid: 0, map_gid: 0 end
The last two lines of the
Vagrantfile are what allows us to run fast volume sharing. In this case, but you might want to adapt them to your needs, I share my
~/src folder as /src and as
/Users/intinig/src on the boot2docker vm.
To start the boot2docker vm you just enter the folder where you have the
Vagrantfile and launch
Let me know how it works for you, happy dockering!