This page looks best with JavaScript enabled

Docker Introduction With Its Architecture And Components

 ·  ☕ 6 min read  ·  ✍️ Adesh

There was an improvement with the creation of Hypervisors. Hypervisors have multiple Virtual machines or VMs on the same host, which may be running or turned off. VMs decreased the waiting time for deploying code and bug fixing in a big manner, but the real game changer was Docker containers.

What is Docker?

Docker is gaining popularity day by day. One of the main reason of Docker’s growing popularity is due to the fact that it can be used in any IT organization.

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Docker applications run in containers that can be used on any system: a developer’s laptop, systems on premises, or in the cloud.

Docker is a tool that is designed to benefit both developers and system administrators, making it a part of many DevOps (developers + operations) toolchains. For developers, it means that they can focus on writing code without worrying about the system that it will ultimately be running on. It also allows them to get a head start by using one of thousands of programs already designed to run in a Docker container as a part of their application. For operations staff, Docker gives flexibility and potentially reduces the number of systems needed because of its small footprint and lower overhead.

Is Docker like Virtual Machine?

In a way, Docker is a bit like a virtual machine. But unlike a virtual machine, rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they’re running on and only requires applications be shipped with things not already running on the host computer. This gives a significant performance boost and reduces the size of the application.

A virtual machine is a Guest operating system on top of the Host operating system. Apart from some advantages of virtualization, there are few disadvantages as well. These are:-

  • Guest OS or running multiple virtual machines on Host operating system takes a large chunk of its system resources like RAM, processor and its hard disk.
  • Virtual machines are not as efficient as its host operating system.
  • Slow boot up time

Virtualization

Virtualization

These drawbacks of virtualization lead to the emergence of a new technique called Containerization.

How Containerization is different from Virtualization?

Containerization provides an isolation to run your application while sharing the same OS resources and in the other hand Virtualization provides the same flavour but it have its own OS so VM systems can run different operating systems and VM will host multiple applications whose mix may change over time versus a container that will normally have a single application.

Containerization is however more efficient because there is no guest OS here and utilizes a host’s operating system, share relevant libraries & resources as and when needed unlike virtual machines.

Advantages of Containerization over Virtualization

  • Since they are using the same OS and other resources, they are lighter, efficient and faster.
  • As compared to VM, there is better resource utilization.
  • Lesser boot up time

Containerization

Containerization

The Docker Engine

Let’s have a quick look at Docker Engine. Docker Engine is used to develop, assemble, ship and run container based applications. Docker Engine has following components:-

  1. Docker Daemon A persistent background process that manages Docker images, containers, networks, and storage volumes. The Docker daemon constantly listens for Docker API requests and processes them. The Docker Daemon is a service that runs on your host operating system. It currently only runs on Linux because it depends on a number of Linux kernel features, but there are a few ways to run Docker on MacOS and Windows too.
  2. Docker Engine REST API The Docker Daemon itself exposes a REST API. From here, a number of different tools can talk to the daemon through this API. it can be accessed by an HTTP client.
  3. Docker CLI It is a command-line tool that lets you talk to the Docker daemon. When you install Docker, you get both the Docker daemon and the Docker CLI tools together.

Docker Engine

Docker Engine

Docker Architecture

Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers. The Docker client and daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface.

Docker Architecture

Image: docs.docker.com

Docker Client

Docker client, this is where we’re running various docker commands to interact with Docker. The client could be installed on your laptop running Windows, MacOS or a server running Linux, it doesn’t matter.

The Docker client provides a command-line interface (CLI) that allows you to issue build, run, and stop application commands to a Docker daemon.

DockerHost

The Docker host provides a complete environment to execute and run applications. It comprises of the Docker daemon, Images, Containers, Networks, and Storage. As previously mentioned, the daemon is responsible for all container-related actions and receives commands via the CLI or the REST API. It can also communicate with other daemons to manage its services.

Docker Registry

Docker registry is the place where Docker images are stored it can be a Public registry or Local registry. Docker Hub and Docker Cloud are public registries that is available for everyone and other option is create your own private registry. Docker is configured to look for images on Docker Hub by default and If you use Docker Datacenter (DDC), it includes Docker Trusted Registry (DTR).

Docker Objects

Various objects are used in the assembling of your application. The main requisite Docker objects are:

Images

Images are a read-only binary template used to build containers. Images also contain metadata that describe the container’s capabilities and needs. Images are used to store and ship applications.

Containers

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.

Services

Services allow you to scale containers across multiple Docker daemons, which all work together as a swarm with multiple managers and workers. Each member of a swarm is a Docker daemon, and the daemons all communicate using the Docker API. A service allows you to define the desired state, such as the number of replicas of the service that must be available at any given time. By default, the service is load-balanced across all worker nodes. To the consumer, the Docker service appears to be a single application. Docker Engine supports swarm mode in Docker 1.12 and higher.

Further Reading

Testing Angular App With Karma And Jasmine

What Is .Net Core?

Best Chrome Extensions For Debugging Angular Apps

Share on

Adesh
WRITTEN BY
Adesh
Technical Architect