Dockerize all the things!

Dockerize all the things!

What Docker is and what is it not.

Docker is a software provided by Docker Inc - it's a technology providing containers.
It provides additional abstraction layer and automation of OS level virtualization on major operating systems (Windows, mac OS and GNU/Linux).
Docker uses isolation of resources based on Linux kernel features like cgroups, kernel namespaces and union-capable file systems.
Docker is based on so-called 'containers', you can run many of them on single Linux host and they're all independent. It's the way of avoiding overhead of starting and maintaining virtual machine.

When to use Docker

It's good choice to use Docker when you need homogeneous environment for every instance of your software.
When all your developers are using docker as development environment it doesn't matter anymore if they're running Windows, Linux or macOS.
I'm also using docker as a way to keep multiple version of the same software available for my development environment. Let's say I need Elasticsearch 1.7 for one project and 5.4 for another - it would be PITA to keep it isolated on macOS or Linux without some containerization. With docker I can easily switch between those versions by just using different elasticsearch images.
My favourite example of how helpful and powerful Docker can be is this 4 years old already blog post from Jessie Frazelle

Good sides

  • you can have multiple versions of the same software
  • good for having a homogeneous development environment
  • lot of already built images available at hub.docker.com
  • docker-compose - my favourite tool to set-up a new projects with separated database, redis, web server, etc.
  • when used on linux it's really quick
  • since WSL it works fine on Windows too
  • many of cloud hosting providers supports Docker

Bad sides

  • it may not be so easy to understand different concepts in the beginning (what is image, what is container and how to deal with Dockerfiles)
  • on macOS its performance is quite poor due to the implementation
  • when you're not cautious, sometimes upgrade process can damage running containers
  • if not taken care of, unused images can eat big parts of storage
  • to run in production you need more than just simple docker commands, it requires orchestration, networking management, persistent volumes, etc.

Summary

Like any technology Docker has it's pros and cons. It's way faster than any virtualization technology like VMWare, VirtualBox or qemu, but it's still not bare metal level of performance.
Like mentioned before - if you want to keep your system clean and need to maintain few versions of the same software - go with Docker, but keep in mind it's not all sunshine and rainbows.

P.S. This blog is running on dockerized ghost

Mateusz Kozak

Mateusz Kozak

Warsaw, Poland