Course contentsShow
← Docker, Kubernetes & CI/CD
Lesson 25 of 8021. Container FundamentalsFree lesson

Inspecting the Role of Runc

Learners will analyze how containerd interacts with runc to interface directly with Linux kernel primitives for spawning actual container processes.

In this lesson, you will learn how runc acts as the low-level engine that breathes life into a container by interacting directly with the Linux kernel.

The Role of the Low-Level Runtime

In previous lessons, we learned that containerd acts as a high-level manager that handles images and storage. However, containerd itself does not know how to "talk" to the Linux kernel to create an isolated process. That job belongs to runc, which is a lightweight, portable CLI tool specifically designed to spawn and run containers according to industry standards.

Think of containerd as the "manager" in an office and runc as the "specialized technician." When the manager decides a task (a container) needs to start, it hands a configuration file to the technician. The technician then performs the heavy lifting by triggering the Linux kernel primitives we studied earlier.

How Runc Communicates with the Kernel

When runc is invoked, it performs three primary steps to create your container:

  1. Namespace Setup: It asks the kernel to create the isolated environments (PID, Network, Mount, etc.) we explored in previous lessons.
  2. Cgroup Application: It applies the resource limits (CPU and memory) you defined to ensure the container doesn’t consume the entire host.
  3. Process Execution: It runs the container’s command as a standard Linux process inside those restricted boundaries.

You can actually see this in action on your host. If you have a container running, you can look for the process:

# This shows the runc process that manages the container
ps aux | grep runc

runc is remarkably simple; it doesn't run as a persistent background daemon. Instead, it creates the container and then exits. Once the container is running, the kernel manages the process directly, and runc is no longer needed until you decide to stop or delete the container. By separating this "spawning" logic into a single-purpose tool, the architecture remains stable, modular, and compliant with open standards.

Key Takeaway: Runc is the specialized executor that translates high-level container configurations into actual Linux namespaces and control groups, interfacing directly with the kernel to spawn your containerized processes.