2.1.1.1 Daemon Container Control
A focused guide to Daemon Container Control, connecting core concepts with practical Docker and container operations.
Daemon container control refers to the daemon's responsibility for managing the full lifecycle of every container on its host — creating, starting, stopping, restarting, and removing containers — in response to requests from clients, while the actual process isolation is delegated further down to lower-level runtime components.
The Daemon Issues, Lower Layers Execute
When the daemon receives a request to start a container, it does not directly manipulate kernel namespaces itself; it delegates that work to containerd and ultimately runc, while the daemon itself tracks the resulting container's state and exposes it through the API and CLI.
docker run -d --name myapp myapp:1.0
docker inspect myapp --format '{{.State.Status}}'
The daemon reports the container's status because it tracks it, even though the actual process isolation was carried out by components beneath it.
Lifecycle Operations the Daemon Coordinates
The daemon handles every stage of a container's life: creating it from an image, starting its main process, stopping it gracefully (sending a termination signal and waiting before forcing a stop), and removing it entirely once no longer needed.
docker create --name myapp myapp:1.0
docker start myapp
docker stop myapp
docker rm myapp
Each of these commands corresponds to a distinct lifecycle operation the daemon performs and tracks independently.
Restart Policies as Daemon-Managed Behavior
The daemon can be told to automatically restart a container under certain conditions, a policy it enforces on its own without requiring a client to issue a new start command each time the container exits.
docker run -d --restart=unless-stopped myapp:1.0
Tracking Resource Usage Per Container
Beyond lifecycle state, the daemon tracks each container's resource usage, exposing it through commands that query the daemon's live view of running containers.
docker stats myapp
Why Centralizing Container Control in the Daemon Matters
Because the daemon is the single point through which every container's lifecycle and state pass, querying it gives a complete and authoritative view of everything running on the host, rather than requiring separate inspection of individual container processes through other operating system tools.