The DevOps Roadmap: Docker

Published 13.03.2021

Author Hrittik Roy

Categories Engineering

Table of Contents

The containerization revolution has just begun, which means you have heard about docker at least once in your professional life. Containerization has made our apps’ deployment cycle faster and efficient. Leading the containerization wave is docker, the most popular container runtime.

Containers, containerization doesn’t click so well? Read this curated post to get accustomed to every prerequisite.

Back to dockers, and in this post, we would dive into this topic and understand its ins and outs with a high-level overview.

What is Docker?

Docker is a tool or platform that makes it easier to create, deploy, package, and ship applications and their components like libraries and other dependencies together. Its main goal is to simplify the application deployment process on Linux. Linux because it’s the most used server OS.

Docker. Source:Freecodecamp

The container runtime enables many containers to operate on the same hardware (aka virtualization), resulting in increased efficiency, isolation of applications, and ease of configuration.

How does Docker work?

Docker packs an application and all of its dependencies in a virtual container that can be run on any Linux server. To function the docker container is composed of the following components:

Daemon: The Docker daemon ( dockerd ) manages Docker resources such as images, containers, networks, and volumes by listening for Docker API requests. To control Docker services, a daemon may interact with other daemons.

High-Level REST API: It allows users to communicate with the daemon or the dockerd.

A CLI: It is a command-line tool (aka docker client) that lets you talk to the Docker daemon.

Docker Engine
Docker Engine. Source: FAUN

How is a docker container built?

Docker containers are built using a docker image which in turn is created using a dockerfile.

What’s dockerfile?

The dockerfile consists of the instructions which are needed to build a docker image. Every time you run a new command, a new layer is built on top of the existing layer in the docker image called intermediate images.

A simple Node.js docker file:

FROM node:stable
COPY . /usr/src/app/
RUN npm install && npm run build
ENTRYPOINT ["npm", "start"]

What is a docker image?

If you build using the dockerfile, the result is called a docker image. To build use the command docker build. The docker image is layered and hashed, with each layer containing new instructions.

Docker container images hashed
Hashed Container Image layers. Source: FAUN

Since all layers are hashed, Docker can cache them and reduce build times for layers that don’t change between builds. If the COPY phase hasn’t changed, you won’t have to restore and re-copy any of the files, saving you a lot of time in the build process.

Docker builds a new thin writable layer on top of all other layers at the end of the build process.

So, what’s the docker container?

The docker container is the running instance of the docker image.

We can sum things up as:

  • dockerfile is a recipe for creating Docker images
  • A Docker image gets built by running a Docker command (which uses that dockerfile)
  • A Docker container is a running instance of a Docker image

What are docker registries?

It’s not always necessary that you need to build all the images on your own using custom dockerfile. It’s a common practice to pull images (use docker pull) from Docker registries or the store containing many prebuilt images.

So common that if you pick a course, you will interact with pulling docker images from repositories and not building from your own dockerfile.

Docker image being pulled from Registry
Docker image being pulled from Registry. Source: Docker docs

Docker provides an option to have public or private (for inter-organization use) registries to help you with the hassle of building images on your own every time. You can get images from them and also upload your own images to use later on by using docker push.

Commands Crash Course

You might have come across many commands in this post, and this section summarizes all of these commands for you to reference.

$ docker build

This command is used to build a fresh image from your docker file and store it to your local docker image directory. This image can later be published to registry.

$ docker pull

This command lets you pull an existing image from a docker registry and save it to your local docker image directory. Later on, this image can be used to spin up containers.

$ docker run

This command lets you run a container out of an existing container image.

$ docker push

This command helps you to push an image or a repository to a registry.

Final Thoughts

I hope this post helped you understand docker and its key terminologies besides the back-end with the daemon and APIs. Docker is a leap, and if you want to explore more, like why docker is better than VMs.

You can read this post.

Interested in best containerization practices? Here we go!

That’s it for now, then. Thanks for reading, and don’t forget to check the official docker docs for more information.

Happy Containerizing!

Join 100+ cloud native enthusiasts

and stay in the loop on modern software development.

Sign up to receive exclusive content around cloud native software development right into your inbox.

We don’t spam! Read our privacy policy for more info.

More stories from our blog

How To Install Docker on Ubuntu 20.04?

How To Install Docker on Ubuntu 20.04?

Docker is an open-source tool that makes managing application processes in containers much easier. Containers allow you to run your programmes in separate processes with their own resources. Containers are comparable to virtual machines, except they're more portable,...

Answer to Everything isn’t 42, it’s Family

Answer to Everything isn’t 42, it’s Family

We’re experiencing digitisation. An era where every person has a voice, and it doesn’t matter if he’s wise. There’s more motivation circulating the vast stretches of the internet than it’s required. This would be good in a theoretical world, but if you seek the truth,...

What’s new in Gitlab 14? 🦊

What’s new in Gitlab 14? 🦊

GitLab 14 is out and fans must be thrilled to know about all the new features along with all the fixes and removals. In this post, we will go through the many changes and improvements, bug fixes, and some remarkable deprecations. We will see all of that here. So,...

k8s vs k3s: The Comprehensive Difference

k8s vs k3s: The Comprehensive Difference

Kubernetes is undoubtedly a champion in the container orchestration world. But currently, we see that K3s or a lightweight Kubernetes distribution which is light, efficient and fast with a drastically small footprint levelling up. Businesses nowadays scratch their...

What’s new in Fluentbit v1.8.1?

What’s new in Fluentbit v1.8.1?

Fluentbit is a lightweight and fast data processor and forwarder for Linux, BSD and OSX. And, for Fluentbit fans, there is good news as they have released their new update with lots of new features and fixes. We will have a look at all of them below. New Metrics...

What’s new in Envoy v1.19.0?

What’s new in Envoy v1.19.0?

Envoyproxy introduced its new version, 1.19.0, recently, and it came with many changes and improvements from the previous ones. We can see more stability in this version, along with specific bug fixes. So, without waiting any further, let’s see what the new version...

What’s new in Vitess 10?

What’s new in Vitess 10?

Vitess 10 is released with many excellent features and also many bug fixes that were bothering the user base. We are going to see all the features and exciting announcements. So, Let's roll! Major Themes in Vitess In this release, we can see that Vitess Maintainers...

What’s new in Contour 1.17.0?

What’s new in Contour 1.17.0?

Contour 1.17.0 is out with a layer seven HTTP reverse proxy for Kubernetes clusters. The new version has arrived with many new features and several fixes, which will make the functioning of the ingress controller smoother. More activities within the community came...

What’s new in Prometheus 2.28?

What’s new in Prometheus 2.28?

Prometheus 2.28 is out. If you don't know, Prometheus is an excellent open-source system monitoring and alerting toolkit. Let's have a look at those features and have a look at the changelog. Displaying Trace Examplers in the Graphic Interface From the previous...

GPT-J: GPT-3 Democratized

GPT-J: GPT-3 Democratized

GPT-J is the open source cousin of GPT-3 that everyone can use. The open source transformer is all about democratizing transformers and with 6b parameters it’s the largest transformer available. Read more here

Interested in what we do? Looking for help? Wanna talk about software strategy?