In this lesson, you will learn how a simple command travels from your terminal through the Docker architecture to launch a running process.
When you type a command like docker run hello-world, you aren't talking directly to the container; you are initiating a relay race. Understanding this interaction flow is essential for debugging why a container might fail to start.
The Lifecycle Path
- The Client Request: Your CLI sends a request to the Docker Daemon (the background manager) via the Docker API.
- Daemon Logic: The Daemon receives this request, validates the image, and determines the resource constraints (cgroups) and isolation requirements (namespaces) needed.
- Handoff to Containerd: Because the Daemon focuses on high-level orchestration, it offloads the actual process execution to
containerd. Think ofcontainerdas the "middle manager" that handles the image content store and supervises the lifecycle. - The Runtime (runc):
containerdcallsrunc. This is the low-level component that touches the Linux kernel.runcperforms the heavy lifting: it sets up the namespaces, applies the cgroup limits, and finally triggers theexeccall that turns your image into a live process.
Visualizing the Relay
Think of it like ordering a meal in a restaurant:
- You (CLI): Place the order.
- Waiter (Daemon): Takes your order to the kitchen and handles the logistics.
- Kitchen Manager (Containerd): Manages the ingredients (images) and assigns tasks.
- Chef (runc): Physically prepares the meal using the kitchen tools (Kernel isolation).
[User] -> [CLI] -> [Docker Daemon] -> [containerd] -> [runc] -> [Kernel/Process]
If the flow breaks, you can analyze the interaction by looking at the logs. If the error occurs during the "Handoff," you’ll see it in the Docker Daemon logs. If it occurs during the process creation, you’ll likely find the error in containerd or the specific container logs. By tracing this flow, you can distinguish between a configuration error (Daemon) and a system-level isolation failure (runc/Kernel).
Key Takeaway: The Docker CLI triggers a structured relay where the Daemon orchestrates, containerd manages the state, and runc enforces isolation, creating a modular pipeline from your command to the kernel process.