First Look At Docker Containers

Published 2016-11-01

Docker is a tool used to build and deploy code in containers.

When I first heard of Docker, it was only available on Linux and was still in its early stages. Now there is an installer for Mac OS and Windows with a nice GUI called Kitematic. I decided to give it a try and see if it would be useful to separate production code into multiple microservices.

There are some things I really like about Docker:

There is also a tool called Docker Compose which allows you to define an entire infrastructure (or stack) of containers and how they are linked or isolated from each other. This adds a little more complexity to deployments because one container might depend on another, say a user-registration-service container might depend on a db-sql container.

Docker eliminates the need to install additional software (besides Docker). Think of it as the last dependency you'll need. For example, if I wanted to run Elasticsearch, I would have to read the installation requirements, see that I need to install Java, then configure environment variables, then install Elasticsearch, then change the ES config file. That could take a couple hours. Now I configured everything the way I want it and it works on my machine, my app can talk to Elasticsearch. But how can I move this to production? I have to do this all over again on a machine that might be running a different OS!

With Docker, all you need to do is create an ES Config file and build a docker image based on the official elasticsearch image. Then that image can be deployed anywhere Docker works! Need to run 3 Elasticsearch nodes? No problem, just deploy the image 3 times.

Overall, docker is a great step in the right direction but the uncertainty of upgrading the docker engine on a production server leaves me a little cautious for now.