Introducing dvm - Docker in a box for Unsupported Platforms, like the Mac
Back to the Blog Page

Introducing dvm - Docker in a box for Unsupported Platforms, like the Mac

by Fletcher Nichol | Tuesday, January 7, 2014

If you find yourself using an Operating System that doesn’t natively support Docker, then give dvm a spin.

Update 2014-01-10

In order to make updates simpler, a Homebrew tap has been setup for dvm at fnichol/hombrew-dvm and the vendored formula has been moved to that repository. The examples below have been updated to reflect this.

Update 2014-01-08

As we know, the Docker and Homebrew communities move very fast. Now you can install Docker via Homebrew with brew tap homebrew/binary ; brew install docker–nice and simple. The examples below have also been updated to reflect this.


Docker is pretty awesome technology and is being used everywhere these days. But what if your workstation du jour is a Mac or another platform that doesn’t yet support running the Docker daemon? In that case, there’s a good chance you’re using and abusing Vagrant on a daily basis–as am I.

As someone who typically uses a Mac for development, I’ve been keeping tabs on several projects over the last month that have finally landed:

After a few hours of very enjoyable hacking I was able to boot the Vagrant base box–with a private network setup no less–and use the docker binary on my Mac spin up containers. In order to help manage the virtual machine from any directory and deal with future Vagrantfile updates, I cranked out dvm to smooth out any remaining rough edges.

Assuming you have Vagrant and VirtualBox set up, here are the resulting steps to get up and running with dvm on a Mac:

# Install Docker Mac binary (see note below)
brew tap homebrew/binary
brew install docker

# Install dvm
brew tap fnichol/dvm
brew install dvm

# Bring up your Vagrant/Docker VM
dvm up

# Set a DOCKER_HOST environment variable that points to your VM
eval $(dvm env)

# Run plain 'ol Docker commands right from your Mac
docker run ubuntu cat /etc/lsb-release

If you are a Test Kitchen user, dvm shoud make an excellent pair with Sean Porter’s Kitchen Docker Driver. In your .kitchen.local.yml try this out:

  name: docker
  socket: tcp://

or if you prefer to use the DOCKER_HOST environment variable that dvm provides, try:

  name: docker
  socket: <%= ENV['DOCKER_HOST'] %>

For more details, check out dvm’s project page and let me know how it’s working!

Image: Container Ship by Blake Danger Bently is available from Flickr and is released under a Creative Commons Attribution-NonCommercial 2.0 Generic license.