Docker is a client-server technology. The client talks to the daemon (dockerd) over a REST API — either via Unix sockets or over the network.
A container is a running process with its own environment. An image is that environment. The default process to run is defined by the CMD instruction.
Docker Engine
Docker Engine is the mechanism that creates and runs containers. It consists of three main parts:
- daemon (
dockerd) containerdrunc
daemon
The dockerd daemon is what the Docker client talks to via the REST API.
runc
An OCI runtime implementation — a lightweight wrapper around libcontainer. Its only job is to create containers.
containerd
Sits between the daemon and runc. Handles container lifecycle (start, stop, pause, delete) and image management (pull/push).
shim
Decouples running containers from the daemon.
When a container is created:
containerdforks aruncinstance.- After the container is created,
runcexits. - The shim becomes the new parent of the container.
This lets you run hundreds of containers without hundreds of long-lived runc processes.
The shim also:
- keeps STDIN and STDOUT open so containers survive a daemon restart;
- reports exit status back to the Docker daemon.
Container start flow
What happens when you run docker run:
- The CLI executes a command.
- The Docker client builds the appropriate API payload.
- It POSTs to the correct API endpoint.
- The Docker daemon receives the instructions.
- The daemon calls
containerdto start a new container (via gRPC). containerdcreates an OCI bundle from the Docker image.- It tells
runcto create a container from that bundle. runctalks to the kernel for namespaces, cgroups, and other constructs.- The container process starts as a child process.
- Once the container is running,
runcexits.
Container-focused OS distros
Docker runs on most modern Linux distributions, but several projects target lightweight hosts whose main job is running containers (or containers plus VMs):
Related topics
- Containers — lifecycle states
- Images overview — layers and UnionFS
- Storage — volumes, bind mounts, persistence
- Networking — CNM, drivers, Swarm networks
Andrew Dorokhov