Introduction And Architecture

Docker is an open container management platform. It is a software platform for developing, shipping, and running applications based on containers --- small and lightweight execution environments that make shared use of the operating system kernel and run it in isolation from one another. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.

With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker's methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

Let me give you my real experience of the first time I needed Docker in my career. I was assigned with a task to validate source code of two applications at a time. First application had one of the dependencies of pywinrm 1.1 and the second one also had a dependency of pywinrm 2.2. So at a time, I would be able to test only one application. So what I could do, I could have created two VM and installed each application on a separate VM but VMs will take more memory and more resources from the host machine. So this is where I took the help of containerization.

VMs vs Containers


What is a Virtual Machine?

Virtual Machine is a system which acts exactly like a computer. VMs are like physical hardware turning one server into many servers. It uses technology called hypervisor which allows multiple VMs to run on a single machine. Each VM has a full copy of an operating system, the application, necessary binaries and libraries. VMs are bulky in nature.

They have a full OS with its own memory management installed with the associated overhead of virtual device drivers. In a virtual machine, valuable resources are emulated for the guest OS and hypervisor, which makes it possible to run many instances of one or more operating systems in parallel on a single machine (or host). Every guest OS runs as an individual entity from the host system. Hence, we can look at it an independent full-fledge house where we don't share any resources.

What are Containers?

Due to the large number of libraries, packages, dependencies and other software components required for an application to run, it is one of the major issues of modern software development to operate and maintain these heavy applications in a cluster isolated from one another without interfering with each other's operations. One solution to this problem is virtual machines, which keep applications on the same hardware entirely separate, and reduce conflicts among software components but virtual machines are bulky as it requires its own OS making it difficult to maintain and upgrade.

Unlike this, Containers isolate application environments from one another, and only share the underlying OS kernel. Containers are an abstraction at the app layer that packages code and dependencies together. By default, a container is relatively well isolated from other containers and its host machine. You can control how isolated a container's network, storage, or other underlying subsystems are from other containers or from the host machine. Multiple containers can run on the same machine and share the OS kernel with other containers, each running as isolated processes in user space. Containers take up less space than VMs (container images are typically tens of MBs in size), can handle more applications and require fewer VMs and Operating systems.

If we specifically talk about Docker containers, Docker containers are executed with the Docker engine rather than the hypervisor. Containers are therefore smaller than Virtual Machines and enable faster start up with better performance, less isolation and greater compatibility possible due to sharing of the host's kernel. Hence, it looks very similar to the housing society homes where we share resources of the society.

The following are the significant differences between Docker and VMs

  • OS and Architecture: Virtual machines have a host OS and the guest OS inside each VM. Guest OS can be any OS, like Linux or Windows, irrespective of host OS. While Docker containers host on a single physical server with a host OS, which shares among them. As it shares the host OS between containers it makes them light and increases the boot time.
  • Portability: Virtual machines are isolated from their OS, and so, they cannot be ported across multiple platforms. Docker containers can be easily ported across different platforms as they are self-contained and can run applications in any environment, and since they don't need a guest OS.
  • Performance: Virtual machines are more bulkier than Docker containers as the virtual machines need to load the entire OS to start. The lightweight architecture of Docker containers are light weight as they don't have a guest OS.

Container advantages

  • Docker containers provide a way to build applications that are lightweight, easier to assemble, maintain, and port around than their counterparts.
  • Containers Are More Agile than VMs
  • Containers Enable Hybrid and Multi-Cloud Adoption
  • Integrate Containers with Your Existing IT Processes
  • Containers Save on VM Licensing
  • Containers are popular now because they have Virtual Machines beat
  • Containers has ability to keep apps isolated not only from each other but also from their underlying system
  • They're more flexible and tenable

Virtual Machine Disadvantages

  • VMs contain full copies of an operating system, the application, necessary binaries, and libraries - taking up tens of GBs
  • VMs can also be slow to boot. In contrast, Docker containers take up less space (their images are usually only tens of MBs big), handle more applications, and use fewer VMs and Operating Systems.

What is Docker?

Docker is an open-source platform that makes it easy to create containers and container-based apps. To understand how Docker works, let's take a look at its architecture and some of the components you would use to create Docker-containerized applications.

Docker is written in the Go language. It uses a technology called namespaces to provide the isolated workspace called the container. When you run a container, Docker creates a set of namespaces for that container. These namespaces provide a layer of isolation. Each container runs in a separate namespace and its access is limited to that namespace.

Docker architecture

Docker uses a client-server architecture. The Docker client communicates with the Docker daemon, which is responsible for building, running, and distributing your Docker containers. The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface.

docker-introduction-and-architecture Image source: Docker Official documentation


Image source: Docker Official documentation

Docker daemon

The Docker daemon (dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to manage Docker services.

Docker client

The Docker client (docker) is the primary way that many Docker users interact with Docker. When you use commands such as docker run, the client sends these commands to dockerd, which runs them. The docker command uses the Docker API.

Docker registries

A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and by default Docker looks for images on Docker Hub. You can even run your own private registry. 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.

Docker Components


An image is a read-only template with instructions for creating a Docker container. For example, you can build an image which is based on the ubuntu image, and install the Apache web server and your application, as well as the configuration details needed to make your application run.

You can create your own images and publish them in a registry. To build your own image, you create a Dockerfile with a simple syntax for defining the steps needed to create the image and run it. Each instruction in a Dockerfile creates a layer in the image. When you change the Dockerfile and rebuild the image, only those layers which have changed are rebuilt. This makes images lightweight, small, and fast, as compared to other virtualization technologies.


A container is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI.It is isolated from other containers and its host machine. When a container is removed, any changes made to its state that are not stored in persistent volumes will also get removed.

Docker vs. Virtual Machine: Which is a Better Choice?


A lot of people have this question, but the answer to this so far cannot be ascertained, but depending upon their configurations and advantages we could say that containers are overcoming virtual machines. The famous global researcher Gartner has predicted that by 2023, more than 50% of companies will adopt Docker containers. However, a serverless container like Docker will have a raise in revenue from a small base of $465.8 million in 2020 to $944 million in 2024