Docker & Vagrant & VMware Fusion bug

I was playing around with my new Mac this week since I started at Intel on Monday. I was starting to play with the Docker provider for Vagrant when I ran into some issues with it.

For those that aren’t up to speed – Vagrant now supports Docker as a Provider via plugin. If you are running on a system without native Docker support Vagrant will bootstrap a box that is native and proxy Docker commands into it. Rather slick if you ask me.

Problem is there appears to be a bug with a recent release of the vmware_fusion provider plugin which is breaking this functionality with VMware Fusion. By default the Docker provider uses a box hosted on Vagrant Cloud called mitchellh/boot2docker. This box is a lgithweight VM with an ISO mounted that is used to live boot. The bug has something to do with mucking up IDE/CDROM binding for Vmware Fusion VMX files. I didn’t dive into the bug for details.

I did search for workarounds and found some. But they were all a bit specific and fragile. Instead of using them I decided to use the built-in magic that Vagrant already provides with their Docker provider that allows you to select the box you want to use. So instead of using the currently broken mitchellh/boot2docker (on vmware_desktop) we will select a different box.

We need a box with native docker support. An Ubuntu box would serve nicely but you can use your flavor of distro. There is the option to choose a box with a built-in docker stack. I chose to use Vagrant’s Docker installer functionality to automatically install the latest Docker. This takes a little longer upfront but ensures I have the new hotness.

I uploaded my setup to Github here: https://github.com/lynxbat/boot2docker-fixie-example

The instruction from the README:

git clone git@github.com:lynxbat/boot2docker-fixie-example.git
cd boot2docker-fixie-example/docker_container
vagrant up

This will bring up the vagrant host VM (box-cutter/ubuntu1404), build a Docker image, and then run a container exposing port 80 and mapping to the host vm on port 8080. Then after the container comes up just run:

rake demo

To open up the Apache2 default page in your browser (host_vm:8080). This is apache2 running in a container on top of your host VM. Hopefully this example helps someone else in getting Vagrant and VMware Fusion working again with Docker while the bug is being fixed.

PS –  there is a weird bug where you get this:

Stderr: 2014/06/12 13:49:01 Get http:///var/run/docker.sock/v1.12/containers/json?all=1: dial unix /var/run/docker.sock: permission denied

If you run ‘vagrant up’ a second time it usually fixes itself.

Cheers,

.nick

 

Cloud Fixes Tools

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: