I kept hearing about Docker, Containers, Kubernetes, etc. buzzwords for quite a few years now, so much so that last week I decided to read up on Docker to get a cursory understanding of the technology.

Based on my reading so far, I am now convinced that it's going to change the way we do DevOps, especially in enterprise. Looks like the startups and the tech giants have already wholeheartedly adopted the platform. Now it's the turn of the good old enterprise, and I want to be part of this revolution. Here's my understanding of Docker and the related jargon, so far.

Docker is a platform that allows us to separate applications from the underlying infrastructure. 

The fundamental technology behind Docker is the container. In its essence, a container is an encapsulated and isolated process. Containers are a great invention, because they are: 
  • Flexible: Even the most complex applications can be containerized.
  • Lightweight: Containers leverage and share the host kernel, making them much more efficient in terms of system resources than virtual machines.
  • Portable: You can build locally, deploy to the cloud, and run anywhere.
  • Loosely coupled: Containers are highly self sufficient and encapsulated, allowing you to replace or upgrade one without disrupting others.
  • Scalable: You can increase and automatically distribute container replicas across a datacenter.
  • Secure: Containers apply aggressive constraints and isolations to processes without any configuration required on the part of the user.
Docker runs as a client-server application. When you launch Docker, it starts a background service on Windows, or a daemon on Linux. This is the server. The client is a command line interface which interacts with the server using a REST API. The client can be anything that consumes the API. The client and the server can run on the same machine, or they can be on a different machines, communicating over a network interface.

The server daemon is responsible for managing Docker objects, such as images, containers, networks, storage, etc. A brief description of each object follows.

A Docker image is similar to classes in a programming language. It provides a template for creating a Docker container, which can be thought of running instances of that class image. Similar to classes deriving from each other, a Docker image can be based on another image with it's own customizations.

Docker registry stores the Docker images. DockerHub is a public registry, similar to Github. You can create and store images on your own private registry, behind your firewall. Similar to Github, when you use the docker pull or docker run commands, the required images are pulled from your configured registry. When you use the docker push command, your image is pushed to your configured registry.

A container is an isolated environment in which applications are packaged and run. Because it's isolated from other containers, we can run many containers at the same time on a given host. Containers are different from a virtual machine, and run on the host machine's kernel. They don't have all the overhead of a hypervisor, and are very lightweight, and hence fast. We can connect a container to a network, attach storage, and create new images from its current state.

An important point to remember about containers is that when we remove a container, any changes in its state that are not persisted disappear. So be careful.

A typical workflow when working with Docker:
  1. Create Docker images for various parts of your application. 
  2. Create containers from these images. 
  3. Assemble these containers by using Docker compose
  4. Deploy the complete containerized application on your Docker registry, from where it can be downloaded and run by users or other developers, without any further configuration, as long as they are running Docker. 
The fourth point is where I was sold on Docker. Once you build an image, it will isolate all the dependencies your app needs. Your users don't have to install anything other than Docker to have the exact application everywhere. Same goes for developers. New developers can have the exact development environment set up from a single base image. 

Docker is written in Go programming language. Originally, it was developed on Linux, as the underlying technology of namespaces, which provide the isolation, existed on Linux. As it got popular, Windows wanted to join too, so they added support for namespaces in Windows Server 2016. 

More will be coming soon, as I dive deep into my research on Docker and containerization of applications.