Glu Blog

Setting up Docker on OS X

In the past running Docker hasn't been as easy Mac owners as it has for those running a Linux distro. Primarily because OS X doesn't support the kernel features required to run Docker. The solution was to spin up a virtual machine, run Linux in that VM, and then run Docker on Linux like everyone else. To take the hassle out of doing all of that manually some lovely people created boot2docker.

But that's now been replaced by the Docker Toolbox and life is even easier.

'Hello World' in 60 seconds

Getting Docker running on OS X is an absolute breeze now, simply:

When you first run the Quickstart Terminal it will use Docker Machine to setup new client/server certificates and create a new VirtualBox virtual mahcine. That VM will have a lightweight Linux distro on it with Docker installed. It starts the VM, uploads your SSH key, and then connects over SSH leaving you at prompt to start playing. Running docker run hello-world will then try and run the hello-world container, find that it doesn't exist, and as a result downloads it from Docker Hub. The output from that container also gives you a run-down on what's just happened:

$ docker run hello-word
... (snip) ...
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
... (snip) ...

Enter Kitematic

That's a whirlwind tour of getting and running a container via the CLI and it's good practice for when you start running containers in production. But this is OS X so there should be no surprise there's also a GUI to get the job done. Toolbox also installed an app called Kitematic which adds a beautiful interface to managing local containers:

Docker Kitematic

In the pane on the left you'll see a list of containers you have available to run locally. And on the right a glimpse of the huge number available via Docker Hub. There's also a search box at the top to help you find others that exist already on Hub. Chances are someone has already packaged your favorite service up as a container.

Glenn Gillen

I'm the founder of Glu. I'm also an investor and advisor to early-stage tech startups. Previously worked at Heroku on the Add-ons Marketplace.

We're currently accepting a limited number of new users for our first product, ContentFocus.