docker-machine

Earlier knows as boot2docker and the image it boots still is named boot2docker.iso. There are different drivers, below I’ll use virtual box which is very common on Mac OS X.

So on OS X creating a virtualbox docker host can look like this:

$ docker-machine create --driver virtualbox docker-test
Running pre-create checks...
Creating machine...
(docker-test) Copying /Users/nippe/.docker/machine/cache/boot2docker.iso to /Users/nippe/.docker/machine/machines/docker-test/boot2docker.iso...
(docker-test) Creating VirtualBox VM...
(docker-test) Creating SSH key...
(docker-test) Starting VM...
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available...
Detecting operating system of created instance...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect Docker to this machine, run: docker-machine env docker-test

docker-registry

Is a repository for docker image files. The most common one is Docker Hub.

> docker run -i -p 3000:3000 grafana/grafana

docker-compose

Do docker or the docker engine enables us to run images in containers, which is great. Only thing is, usually our applications consist of more than one box. Here’s where docker compose comes in, it lets us specify entire environments.

Lets take an example: We want to spin up a solution with 3 boxes (web server with node.js, redis server and a mongo database). We might create a docker-compose.yml-file looking something like this:

In this case I have a Dockerfile in the same folder as docker-compose.yml that defines my node environment.

Then we build it and start it:

> docker-compose build
> docker-compose up

And it spins up an entire environment with 3 containers. To check we can open another terminal (don’t forget the eval-trick mentioned earlier to set up docker environment variables, they are per terminal session) and run docker ps: