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:

  • If it builds on my system it will build on your system (build steps are defined in a Dockerfile kind of like a Makefile)
  • If it runs on my system, it will run on your system (kind of like Node.js or JVM but for all programming languages and runtimes)
  • The OS is bundled in the built image (yes you deploy the OS, libs, and app code)
  • Docker Hub centralizes software builds and deployments in a single registry (think NPM if your a Node.js enthusiast)

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.