Skip to content
tezvyn:

Describe the relationship between containerd and runc in starting a container.

Source: containerd.ioMediumHow cards are made

Tests the OCI runtime split and lifecycle ownership. A great answer states containerd handles image pull, storage, and API lifecycle, then invokes runC to spawn the isolated process.

What's really being asked

This question probes your understanding of the OCI runtime architecture and the clear separation of concerns between high-level and low-level runtimes. Interviewers want to see that you know containerd is a daemon managing the full container lifecycle, while runC is a stateless, low-level executor that only knows how to create and run an isolated process from an OCI bundle. It also checks whether you understand that Kubernetes and Docker rely on this split.

The full answer

First, define containerd as the CNCF-graduated, daemon-based container runtime that exposes a gRPC API and manages image pull and push, content storage, snapshot management, network namespace attachment, and container supervision. Second, explain that when a container is requested, containerd prepares an OCI bundle, which includes a root filesystem and a config.json file describing the process, environment, namespaces, and cgroups. Third, state that containerd delegates the actual creation of the container process to runC by invoking it as a binary; runC implements the OCI Runtime Spec and is responsible for setting up Linux namespaces, cgroups, capabilities, and seccomp profiles, then execing the user process inside that isolation boundary. Fourth, note that after runC starts the process, containerd retains ownership of the container for lifecycle operations like stop, delete, and event monitoring, while runC exits and remains stateless.

The mistakes people make

A major red flag is saying containerd directly creates namespaces and cgroups itself; that conflates the two layers. Another is claiming runC pulls images or manages networking, which it does not do. Some candidates say runC is a long-running daemon; it is actually a short-lived CLI tool that exits after starting the container. Also avoid stating that containerd replaces runC; they are complementary, not competitors.

What usually comes next

An interviewer might ask how containerd compares to the CRI-O runtime, or what happens if the containerd daemon restarts while containers are running. They could also ask about the shim process: containerd uses a per-container shim to allow runC to exit while keeping stdio and exit status forwarding alive. Another follow-up is how this architecture improves security by reducing the attack surface of the low-level runtime.

A concrete example

When Kubernetes kubelet asks containerd via the CRI to start a pod, containerd pulls the image into its content store, creates a snapshot of the rootfs, generates the OCI runtime spec, and then forks runC create followed by runC start. RunC reads the spec, configures the pid namespace, mount namespace, and cgroup v2 limits, and finally execs the container entrypoint. Containerd then monitors the container through its shim and reports status back to kubelet.

Interview question

Once runc has started the container process, which statement accurately describes its subsequent behavior?

  • a.It continues running as a child process of containerd to enforce the OCI runtime spec.
  • b.It exits and becomes stateless, leaving containerd to handle stop, delete, and event monitoring.Correct
  • c.It remains resident as a daemon to monitor the container's cgroups and namespaces.
  • d.It converts into the per-container shim that forwards stdio and exit codes to containerd.
Why?

runc is a short-lived CLI tool that exits after starting the isolated process, while containerd retains lifecycle ownership. The belief that runc stays resident as a daemon is a common misconception; it is stateless and does not monitor cgroups or namespaces after launch.

Just read this? Test yourself on what you have been reading.

Read the original → containerd.io

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles