Understanding Docker Architecture: A Beginner's Guide
Tags: docker, dockerarchitecture, devops, containerization
Published: 2024-07-08 18:50:48

For most beginners, Docker's architecture is hard to understand. In this blog post, you will learn everything about Docker architecture and how it works, as easily as possible, with proper visual aids.

### What is Docker?

> Docker is a platform for building, running and shipping application in consistent manners. Docker Solve the famous problem “It works on my machine!”

### Now let’s talk about Docker Engine

Docker uses `client`-`server` architecture. That means docker has its `client` component that to the `server` component using the `REST API` .


![docker-engine-image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/947lz3elp25ieyyom5fz.png)

Server is called Docker Engine, set in the background and takes care of building and running the docker containers.

Take a look at the image below

![how-conainter-work](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yv0r5mdc1ok1k69yw51i.png)

Technically a container is a process. It’s a special process, we are not going to discuss about this process in this blog, For now we should now that unlike virtual machines (VM), containers don’t contain full-blown ‘operating system’. Instead, All containers on a host shared the operating system (OS) of the host. More accurately, All its container share kernels of the host.

## What is Kernel ?
A kernel is a core of a  operating system (OS), like engine of car. A kernel manages applications and hardware resources.

Every OS (mac, windows ,Linux) has its won kernels/engines. And this kernels has different API’s. That’s why we can not run mac application on windows or Linux. Because, under the hood this applications is to talk to the kernel underline “OS”. So that means on Linux machines, we can only run Linux containers, Because this container need Linux. On a windows machine however, we can run both ( windows + Linux) container because windows 10 shift with a custom build Linux kernel. Docker on mac uses light weight Linux virtual machine (VM).

![docker-kernel-os-support](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r014tbcikvb2od5us4pn.png)

## Now let’s see docker architecture all together


![architecture-of-docker](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/85sytoxw23nfhhws3d8k.png)

Let's explain some terms that we have seen in the docker architecture.

### What is 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.

## What is 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 docker daemon `dockerd`, which carries them out. The `docker `command uses the Docker API. The Docker client can communicate with more than one daemon.

### Docker registries

A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker looks for images on Docker Hub by default. You can even run your own private registry.

When you use the `docker pull` or `docker run` commands, Docker pulls the required images from your configured registry. When you use the `docker push` command, Docker pushes your image to your configured registry.