So I’ve been messing around with Docker for a while, it’s a technology for containerizing applications. The basic idea is to use the exact same versions of all the dependencies of your application, and to use the same environment for development, staging, testing and production.

If you compare it to a virtual machine, the comparison is something like:

  • A VM runs a kernels and everything around it. A container runs on the host kernel, separated from the other processed using cgroups and namespaces currently using LXC.
  • A VM usually takes seconds to minutes to boot. A container starts in a matter of milliseconds.
  • A VM is usually a bother to move between different environments. A docker image can be started as a container as long as there’s a docker daemon running on the system.

A container in essence is only supposed to run one process (on pid 1), so for a normal web tier application I usually have around 3 or 4 containers. An example of a docker-compose.yml can be found here.

  • A container running my application through uwsgi or whatever application server you like.
  • A container running postgres or some other database backend.
  • A container running postfix, if sending mails is required.
  • In the future, a container running redis for faster django cache.

My basic workflow goes something like it.

  • Build a docker-compose file, for quickly starting and linking the various containers in my application to each other.
  • Develop using said containers, commit and push those changes to Github and/or BitBucket.
  • Allow for travis CI or Jenkins to run the tests on the project.
  • If the tests pass, push the docker images to my production machine and spin up the containers there.

What I currently lack:

  • Letting my CI-component build a docker image, run tests on it, and push it for production use. So that I use the same image that passed testing for deployment in production.
  • Docker Compose support for windows, even though I usually don’t develop on windows I see a lot of missed potential.
  • Building and running tests using cloud CI, I’ve gotten it to work in Jenkins using a docker container running in privileged mode.

I picked up The Docker Book to try and get the bigger picture, for now I switch between reading a chapter or two in the book and trying to port old projects to running on docker.

Development on Docker is still going along rather quickly, especially in regards to managing large amounts of container, across multiple docker hosts using Docker Compose and Docker Machine. It’ll be exciting to see how the workflow ends up in regards to spinning up containers in the cloud.

For instance, this blog entry was made by using the jekyll/jekyll docker image.