What is Docker | A Deep Dive into Docker

What is Docker | A Deep Dive into Docker

ยท

4 min read

What is Docker?

Docker is an open-source container platform that packages an application and its dependencies together in the form of containers. These containerization aspects ensure that the application works in any environment. A developer defines all the applications and their dependencies in a Dockerfile which is then used to build Docker images.

History before Containerization

Before containerization came into the picture, virtualization was the leading way to isolate and organize applications and their dependencies. Virtualization is the technology that can simulate your physical hardware (such as CPU cores, memory, disk) and represent it as a separate machine. It has its own Guest OS, Kernel, process, drivers, etc.

But virtualization had a few drawbacks such as the virtual machines being bulky in size, running multiple virtual machines leading to unstable performance, the boot-up process would usually take a long time and VMs would not solve the problems like portability, software updates, or continuous integration and continuous delivery.

When comparing virtualization vs containerization, you can view containerization as a more modern solution. The benefits of containerization aim to solve many of the problems associated with virtualization. the purpose of the containers is to encapsulate an application and its dependencies within its environment. This encapsulation allows them to run in isolation while using the same system resources and operating system as other containers within the server. Hence, it is lightweight and very portable. We can build, ship, and run anywhere.

vm vs con.avif

The Docker Engine

image.png Docker Engine allows you to develop, assemble, ship, and run applications using the following components:

  • Docker Daemon - The Docker daemon constantly listens for Docker API requests and manages Docker images, containers, networks, and storage volumes.
  • REST API - An API used by applications to interact with the Docker daemon. it can be accessed by an HTTP client.
  • Docker CLI - A command-line interface client for interacting with the Docker daemon. When you run a command using docker, the client sends the command to the daemon, which carries them out. It simplifies how you manage container instances and is one of the key reasons why developers love using Docker.

Now, we have seen how different components are used. Let's see Architecture.

Docker Architecture

Docker uses a client-server architecture that comprises the Docker Client, Docker Host, Network and Storage components, and the Docker Hub. let's look at each of these in detail. Docker_Architecture.png

Client

A client provides a command-line interface (CLI) that allows you to interact with docker. When you run a command, the client sends the command to the daemon. A docker client can communicate with more than one daemon.

Host

Docker Host provides all environments to run and execute an application. It comprises Docker daemon, Images, and containers. As we have seen, the daemon is responsible for container-related action.

Docker File

Instructions to create Docker image. These images can be pulled to create containers in any environment. These images can also be stored online at docker hubs. When you run docker image you get docker containers.

Docker Image

A docker image is a file that bundles together the essentials such as - installation, application code, and its dependencies to execute code. It provides a convenient way to package up applications and preconfigured server environments. Docker Image is run to create a docker container. Docker image is comparable to a snapshot in virtual machine (VM) environments.

Containers

Containers are encapsulated environments in which you run applications. The container is defined by the image and any additional configuration options provided on starting the container, including and not limited to the network connections and storage options, you can also create a new image based on its current state.

Docker Registry

Docker registries are services that provide locations from where you can store and download images. In other words, a Docker registry contains Docker repositories that host one or more Docker Images. When you pull an image, Docker by default looks for it in the public registry and saves the image on your local system. You can also store images on your local machine or push them to the public registry.

Did you find this article valuable?

Support Manav Gupta by becoming a sponsor. Any amount is appreciated!

ย