Getting started with Docker

A Hedgeye colleague who has suffered similar pain from Chef as I have (especially unstable APIs) suggested we switch to Docker, and we’re now pursuing that. So far, we both like it, though we haven’t yet done anything complicated.

To help our future selves and our colleagues use Docker, I’m going to document some stuff here.

To install Docker on my Mac, I followed this nice guide from Chris Jones.

With Docker running, getting started is super easy. Just type:

docker run -it ubuntu /bin/bash

Docker will then pull down a Ubuntu image (unless it has already done so, in which case it will use what you already have), spin up an instance running just bash console (the command you told it to run), and drop you into the console session.

When you’re finished interacting with your instance, type exit and it will log you out and then terminate the instance. It terminates because Docker’s approach is to spin up a container running just one process and shut that container down when the initial process is no longer active. From the initial process, you can, of course, spawn additional processes. But whenever the special initial process closes, your container dies.

Here are some basic Docker commands.

[ More to come ]

Posted by James on Wednesday, December 03, 2014