Month: November 2014

Docker Logo
Docker Whale!

Docker is a new(ish) technology that is changing the way we approach software development. It’s not often that something this disruptive gets unleashed and manages to get so many people excited. For example even though Docker was originally developed using the concept of Linux containers (LXC) Microsoft has taken notice and now they are working on getting Docker running in Windows Servers and will start including Docker inside Windows Servers default installations. That doesn’t impress you? Google, RedHat and Ebay all currently use Docker as part of their software development lifecycle.

So what is Docker? Well go ahead and watch this video: What is docker? Basically I think most developers will agree that setting up environments, servers databases, etc. is one of the most boring things to do when all you want to do is sling code. Add that having to repeat that process for the test environment or production makes the task extra frustrating. Docker promises to get rid of a lot of that redundant and error prone work, their metaphor of how the shipping industry does it is a prefect analogy.

Docker uses Linux containers (LXC) and gives you the ability to set up a extremely lightweight Image of your stack, this image runs on the docker engine and can be shared across environments or developers. At this point you might be asking “Great, well VMWare does the same thing.” Yes it does however VMWare is bloated, it’s super complicated to set up (especially when you need to set up networks etc), is  a huge pain to share images and it wastes so much resources and money. You see with Virtual Machines you have a stack that looks something like this this: Right at the bottom you have a server with it’s own OS, then you need to install a Hypervisor to manage all your VMs after that you install your VM, each VM has it’s own Guest OS, so let’s say you have three VMs on one server, you also have a total of four operating systems on that server. With all these additional operating systems you have the resource costs that come with them.

A really beautiful thing about docker is the ability to build on existing images, so for example say you want a Docker container that runs Tomcat. If you’ve already set up an image that has a Java install all you need to do is extend that image to now contain your Tomcat installation and presto you now have two images, one with only Java installed and another with Java and Tomcat installed and configured. You can then use that image across your entire infrastructure with no other configurations (or at least very little).

Docker containers are extremly lightweight compared to their VMware counterparts, because you do not have multiple operating systems and a really resource intensive Hypervisor. You just have a self-contained container (haha) that only has the binaries/configurations that it needs to run. So you don’t waste resources on running multiple OSes, a Hypervisor etc. In fact the most common docker images that run headless versions of Linux are at around a hundred megabytes big and can run on as little as fifty megabytes of RAM. That’s an entire Linux installation (without the UI). Compare that to what you need to run VMWare where they Hypervisor itself needs more RAM for each Machine it’s hosting (somewhere around 200Mb per Machine) and then each Host Machine needs it’s own RAM allocations. With Docker the RAM will get allocated to the container as needed (although you can set maximums per container if you want). So that means that when a container doesn’t need it’s RAM it’s not just sitting idle, instead the RAM (and CPU and other resources) gets used by other containers if they need it.

Docker Images
Just some official images available in the Docker registry.

One final thing that I would like to say about Docker, there is a vast amount of Images that have already been created that you can download and use freely (I would advise a little caution here, while the risks are not catastrophic I would only use trusted Images if I were you). So you can save a lot of time by just downloading a base image that is similar to what you need and then just configuring that Image. Have a look here at the vast amount of Images just waiting for you to download and run. Just please try to stick to only official images.

In summary I am really excited about Docker and all the good that it will do. There is one thing I am confident about. If you try Docker you will love it, especially if you, like me, have ever spent days of your life trying to configure something only to have to do it again on a new server or someone elses machine.

Until next time, may your things fit nicely into containers.