Introduction to Docker


Whether you are planning to start your career in DevOps, or you are already into it, if you do not have Docker listed on your resume, it’s certainly time for you to learn about it. Turns out, it is one of the must-have skills for any DevOps professional.

In this post, I will try my best to explain Docker in the simplest way I can.

Let’s begin by understanding, What is Docker?

In simple terms, Docker is a software platform that simplifies the process of building, running, managing and distributing applications. It does this by virtualizing the operating system of the computer on which it is installed and running.

The first edition of Docker was released in 2013.

Docker is developed using the GO programming language.

Now let’s try to understand the problem, and the solution Docker has got to offer

The Problem

Let’s say you have 3 different Python-based applications that you plan to host on a single server (which could either be a physical or a virtual machine). Each of these applications makes use of a different version of Python, as well as the associated libraries and dependencies,  differ from one application to another. Since we cannot have different versions of Python installed on the same machine, this prevents us from hosting all 3 applications on the same machine.

The Solution

Let’s look at how we could solve this problem without making use of Docker. In such a scenario, we could solve the problem either by having 3 physical machines, or a single physical machine, which is powerful enough to host and run 3 virtual machines on it. Both the options would allow us to install different versions of Python on each of these machines, along with their associated dependencies.

Irrespective of which solution we choose, the costs associated with procuring and maintaining the hardware is quite expensive.

Now, let’s check out how Docker could be an efficient and cost-effective solution to this problem.

In order to understand this, we need to take a look at how exactly Docker functions.

Image Source:https://www.docker.com/resources/what-container
The machine on which Docker is installed and running is usually referred to as a Docker Host or simply called a Host.

So, whenever you plan to deploy an application on the host, it would create a logical entity on it to host that application. In Docker terminology, we call this logical entity a Container or Docker Container to be more precise.

A Docker Container doesn’t have any operating system installed and running on it. But it would have a virtual copy of the process table, network interface(s), and the file system mount point(s). These have been inherited from the operating system of the host on which the container is hosted and running.Whereas the kernel of the host’s operating system is shared across all the containers that are running on it.

This allows each container to be isolated from the other present on the same host. Thus it supports multiple containers with different application requirements and dependencies to run on the same host, as long as they have the same operating system requirements.

To understand how Docker has been beneficial in solving this problem, you need to refer to the next section, which discusses the advantages and disadvantages of using Docker.

In short, Docker would virtualize the operating system of the host on which it is installed and running, rather than virtualizing the hardware components.

The Advantages and Disadvantages of using Docker

Advantages of using Docker

Some of the key benefits of using Docker are listed below:
  • Docker supports multiple applications with different application requirements and dependencies, to be hosted together on the same host, as long as they have the same operating system requirements.
  • Storage Optimized. A large number of applications can be hosted on the same host, as containers are usually a few megabytes in size and consume very little disk space.
  • Robustness. A container does not have an operating system installed on it. Thus, it consumes very little memory in comparison to a virtual machine (which would have a complete operating system installed and running on it). This also reduces the bootup time to just a few seconds, as compared to a couple of minutes required to boot up a virtual machine.
  • Reduces costs. Docker is less demanding when it comes to the hardware required to run it.

Disadvantages of using Docker

  • Applications with different operating system requirements cannot be hosted together on the same Docker Host. For example, let’s say we have 4 different applications, out of which 3 require a Linux-based operating system and the other application requires a Windows-based operating system. In such a scenario, the 3 applications that require Linux-based operating system can be hosted on a single Docker Host, whereas the application that requires a Windows-based operating system needs to be hosted on a different Docker Host.

Comments

Popular Posts