You are here

First steps with Docker - 1

dockerWhy Docker?

MonBlocNotes runs on a server I rent from OVH, a very dynamic French hosting provider. It happened several times that they delivered a new offer to the market that was more attractive to me than the one I was renting for my web site at that time. In such a case, I subscribe to the new offer, install Linux on the new server, add all software stack I need, and move data from the previous server to the new one.

As I run a few other services on the server (a mail server, a DNS server, a forum, another web site, a Subversion server, etc.), performing the switch is not trivial, and requires me a few days (in elapsed time).

Additionally, one of my children runs a few Minecraft servers on the same machine. And here I have to handle another type of problem: Minecraft Java code does not seem to be really optimized. Every time a server is started, it tends to monopolize almost all available CPU and RAM. It tried to use cpulimit to assign limits, but I was not so happy with it.

A few weks ago, I discovered Docker. It seemed to me that it could be the solution to my two problems: moving a software stack from one machine to another one, and keeping some services isolated. So, I decided to spend some time getting acquainted with Docker. I'll log my day-to-day experiments in this article and in the following ones.

Docker installation on development machine

First step is to install Docker on one of my development machines, namely a Mac running OS X Mavericks (10.9.5). I follow Docker guide.

During VM start up, a message provides information required to connect the client:

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://
    export DOCKER_CERT_PATH=/Users/<user>/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1

Installed Docker version is:

Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): darwin/amd64
Server version: 1.3.0
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): c78088f

Docker daemon can be controlled from command line (boot2docker command). Do not forget to export environment variables, as described above, before using docker command. The docker run hello-world test succeeds without any problem, pulling the hello-world image from the Docker Hub.

Next article