An Introduction to Docker

What is Docker?

I recently found myself in a situation where I was required to explain Docker to the business team at our workplace and trying do that in a way that the CEO will not think he is too dumb to understand what the hell Docker is exactly (my first experience) and its business value. I nailed it!

“Docker provides an open platform of software containers making building, shipping and running our business applications an easy task”

The whole idea is based on packaging your entire application Tech-Stack in a “Sandbox” that contains everything (application and all dependencies) it needs to run or execute in any environment.

Why so much noise about it then?

Cloud computing is the growing trend in the tech industry, and as such, there exists different ways of developing, deploying and accessing business applications. So anytime a majority of the key players in tech tend to agree on a single thing/approach, the thing/approach automatically becomes a big thing. See; Think; Smile;

  • Cloud computing itself
  • Micro-services vs Monoliths talk
  • DevOps
  • Docker/Containerization

Containers, Not Like VM

Containers and virtual machines have similar resource isolation and allocation idea but a complete different architectural approach

VM architecture, left, compare to the Docker architecture, right. (Forcefully borrowed from Docker Docs)

VM’s are highly isolated boxes running their own Guest OSes’ that need a hypervisors to interact with the Host OS (more of abstraction of physical hardware).

Container achieves the isolation by running the applications and their dependencies, as isolated processes in user space on the Host OS (more of abstraction of user space).

Getting started with Docker

For starters Docker needs Linux to do its magic, so if you want Docker on a platform that is not Linux, you’ll need to make some slight adjustments; run Linux on a VM or install Docker Toolbox for Windows or Mac (Update: Docker for Mac and Windows is now generally available and ready for production)

Docker Core Concepts

There are 3 core concepts in Docker, once you get to understand these Docker internal components you become a pro:-

  • Docker images
  • Docker registries
  • Docker containers

Docker images: A read-only template that contains the blueprints for building a Docker container. Think of these as lightweight snapshots of your containers. The Docker images can be easily created within Docker from a new Dockerfile or updating an existing Docker image by tweaking its’ Dockerfile. Alternatively you can pull and use other people’s images from the Docker registries.

Dockerfile is a file that specifies the steps necessary to build a Docker image

Docker registries: Think of it as GitHub for Docker images. Here you can push your images to public or private repositories. This way you can easily share the image with other people and pull other people’s images.

Docker containers: These are equivalents of lightweight VMs running with your app and all the dependencies in isolation. They are created from the Docker images. Remember when I had earlier stated that a Docker image is like a snapshot of a VM, so creating a container from an image is like creating a VM from a snapshot.

Docker Container Lifecycle

It couldn’t be clearer than this!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.