arrow_back
Back

Docker overview: engine, daemon, containerd, and container lifecycle

Andrew Dorokhov Andrew Dorokhov schedule 2 min read
menu_book Table of Contents

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)
  • containerd
  • runc

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:

  • containerd forks a runc instance.
  • After the container is created, runc exits.
  • 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:

  1. The CLI executes a command.
  2. The Docker client builds the appropriate API payload.
  3. It POSTs to the correct API endpoint.
  4. The Docker daemon receives the instructions.
  5. The daemon calls containerd to start a new container (via gRPC).
  6. containerd creates an OCI bundle from the Docker image.
  7. It tells runc to create a container from that bundle.
  8. runc talks to the kernel for namespaces, cgroups, and other constructs.
  9. The container process starts as a child process.
  10. Once the container is running, runc exits.

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):

code

Need Help with Development?

Happy to help — reach out via the contacts or go straight to my Upwork profile.

work View Upwork Profile arrow_forward
Next Article

Docker orchestration: clustering, scheduling, and management

arrow_forward