AWS Builder Center
Docker Architecture Explained: From Docker CLI to Container Runtime

Docker Architecture Explained: From Docker CLI to Container Runtime

Understand how Docker works behind the scenes, including the Docker CLI, daemon, images, containers, containerd, runc, networking, volumes, and the Linux kernel.

Docker Architecture Explained:

How Docker Works Under the Hood

Docker is a containerization platform that allows applications to run in isolated and consistent environments. Instead of installing an application and all its dependencies directly on the host system, Docker packages them into a container.
But how does Docker actually work?
Let's understand the Docker architecture step by step.



1. Docker Architecture Overview

Docker mainly follows a client-server architecture.
The major components are:
Docker Host
│
┌────────┴────────┐
│ │
Docker Client Docker Daemon
(docker CLI) (dockerd)
│
┌─────────────┼─────────────┐
│ │ │
Images Containers Networks
│ │ │
└─────────────┼─────────────┘
│
Container
Runtime

The main components are:
  • Docker Client
  • Docker Daemon
  • Docker Images
  • Docker Containers
  • Container Runtime
  • Docker Registry
  • Docker Networks and Volumes



2. Docker Client

The Docker Client is the interface through which we interact with Docker.
Most commonly, we use the  docker  command.
For example:
docker run nginx
docker ps
docker images
docker build .
docker stop <container>

When we execute a Docker command, the Docker CLI sends a request to the Docker Daemon.
For example:
docker run nginx
↓
Docker Client
↓
Docker Daemon
↓
Create container

The client itself does not create the container. It communicates with the Docker daemon.



3. Docker Daemon

The Docker Daemon ( dockerd ) is the main background service responsible for managing Docker objects.
It manages:
  • Containers
  • Images
  • Networks
  • Volumes
For example, when we execute:
docker run nginx

the Docker client sends the request to  dockerd .
The daemon then:
  1. Checks whether the image is available locally.
  1. Pulls the image from a registry if required.
  1. Creates the container.
  1. Configures networking and storage.
  1. Starts the container.
So the simplified flow is:
Docker CLI
↓
dockerd
↓
Image
↓
Container
↓
Running Application




4. Docker Images

A Docker image is a read-only template used to create containers.
An image contains the application and everything required to run it, such as:
  • Application code
  • Libraries
  • Dependencies
  • Configuration
  • Filesystem contents
For example:
docker pull nginx

downloads the NGINX image from a container registry.
An image is built in layers.
Example:
Application Layer
↓
Configuration Layer
↓
Dependency Layer
↓
Base OS Layer

Because layers can be reused, Docker can build and transfer images efficiently.



5. Docker Container

A container is a running instance of an image.
For example:
docker run -d nginx

Here:
nginx image
↓
container created
↓
nginx process running

We can create multiple containers from the same image:
NGINX Image
/ \
↓ ↓
Container 1 Container 2

Each container has its own isolated process environment, filesystem view, network configuration, etc.
Containers are lightweight because they share the host's Linux kernel instead of running a complete guest operating system like a traditional virtual machine.



6. Container Runtime

Docker uses a container runtime to actually create and run containers.
A common runtime used in modern Docker installations is containerd, which works with lower-level components such as runc.
Simplified flow:
Docker CLI
↓
Docker Daemon
↓
containerd
↓
runc
↓
Linux kernel
↓
Container

The runtime works with Linux kernel features such as:
  • Namespaces
  • Control Groups (cgroups)
  • Capabilities
  • Seccomp
These features provide process isolation and resource control.



7. Docker Registry

A Docker Registry stores container images.
Examples include:
  • Docker Hub
  • Amazon ECR
  • GitHub Container Registry
  • Private registries
For example:
docker pull nginx

The Docker client requests the image, and Docker downloads it from the configured registry.
We can also push our own image:
docker push myusername/myapp:1.0

The basic flow is:
Developer
↓
Build Image
↓
Docker Image
↓
Push
↓
Container Registry
↓
Pull
↓
Server
↓
Container




8. Docker Networking

Docker provides networking so containers can communicate with each other and with external systems.
Common Docker network types include:
  • bridge
  • host
  • none
  • overlay (commonly used with Docker Swarm)
For example:
docker network ls

A container can communicate with another container through a Docker network.
Example:
Frontend Container
│
│ Docker Network
↓
Backend Container
│
↓
Database Container

This allows us to build multi-container applications.



9. Docker Volumes

Containers are designed to be replaceable, so data that must survive container deletion should be stored outside the container's writable layer.
Docker provides volumes for persistent data.
Example:
docker volume create app-data

Then the volume can be mounted into a container.
Container
│
│ mount
↓
Docker Volume
│
↓
Persistent Data

Even if the container is deleted, the data in the volume can remain.



10. Complete Docker Architecture

Putting everything together:
Developer
│
↓
Docker Client
docker CLI
│
↓
Docker Daemon
dockerd
│
┌─────────────┼──────────────┐
↓ ↓ ↓
Images Containers Networks
│ │ │
│ ↓ │
│ containerd │
│ ↓ │
│ runc │
│ ↓ │
│ Linux Kernel │
│
↓
Docker Registry
(Docker Hub/ECR)
Container
│
┌─────┴─────┐
↓ ↓
Volume Network
│ │
Persistent Container
Data Communication




11. Example: Running an NGINX Container

Suppose we execute:
docker run -d -p 8080:80 nginx

What happens?

Step 1 — Docker Client

The CLI sends the request to Docker Daemon.

Step 2 — Docker Daemon

Docker checks whether the  nginx  image exists locally.

Step 3 — Image Pull

If it doesn't exist, Docker pulls it from the registry.

Step 4 — Container Creation

Docker creates a container from the image.

Step 5 — Runtime

The container runtime creates the required isolated environment.

Step 6 — Port Mapping

Docker maps:
Host Port 8080
↓
Container Port 80

So accessing:
http://localhost:8080

can reach NGINX running inside the container.



12. Docker vs Virtual Machine

The key difference is that containers share the host kernel, while virtual machines include a complete guest operating system.
Virtual Machines

Application
↓
Guest OS
↓
Hypervisor
↓
Host OS
↓
Hardware

Docker containers:
Application
↓
Container
↓
Docker Runtime
↓
Host Linux Kernel
↓
Hardware

This makes containers generally faster to start and more lightweight than traditional virtual machines.



Conclusion

Docker uses a client-server architecture where the Docker CLI communicates with the Docker daemon. The daemon manages images, containers, networks, and volumes, while container runtimes such as containerd and runc work with the Linux kernel to run containers.
Understanding this architecture is important because Docker is not simply a command like  docker run . Behind that command, multiple components work together to build, store, create, isolate, network, and run containers.
In one line:
Docker Client → Docker Daemon → Container Runtime → Linux Kernel → Container
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article