The world of containers shifts rapidly. At the time of writing the former recommended method of running Docker on OSX - using the boot2docker CLI to configure a Virtual Box provisioned Linux VM that runs the Docker host - appears to be set to be deprecated. Its replacement is a new CLI called Docker Machine that offers the same functionality as boot2docker, but adds the ability to create and control multiple Docker hosts on a wide variety of providers - such as AWS EC2 instances or DigitalOcean droplets - and to allow these to be used interchangably with the local Docker client.

This is a quick guide on how to get Docker Machine running on OSX, but more importantly how to get a Virtual Box provisioned Docker host running at startup.

Install latest Docker Machine, Docker & Virtual Box

I suggest using brew and brew cask.

$ brew install docker-machine docker
$ brew cask install virtualbox

Create a local Docker host using the Virtual Box driver

If you installed Docker & Docker Machine with Docker Toolkit, this step can be achieved by running the Docker Quickstart Terminal.

$ docker-machine create --driver virtualbox default

Load the local Docker host settings into your environment

$ eval "$(docker-machine env default | tee -a ~/.bash_profile)"

or .bashrc or .zshrc or whatever else you use.

Create a plist file to start the local Docker host

Put this file in ~/Library/LaunchAgents/com.docker.machine.default.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Update the entry /usr/local/bin/docker-machine in the plist with the value of the following command if it’s different on your system. This should only be the case if you didn’t use brew, or use a non-standard brew installation dir. If this applies to you, make sure the PATH value reflects your PATH as docker-machine attempts to invoke VBoxManage which will need to be available on one of those paths.

$ which docker-machine

Use launchctl to load the plist file into launchd

$ launchctl load ~/Library/LaunchAgents/com.docker.machine.default.plist


Alternate Ending for the lazy

This gist provides a way to do the last two steps without having to do any text editing yourself.