What Is a containerd Shim? The Link Between containerd and an OCI Runtime
A containerd shim provides the Runtime v2 service connection between containerd and container tasks. Learn how it differs from runc, why shim processes do not map one-to-one to containers, and how to diagnose failures by boundary.
What Is a containerd Shim? The Link Between containerd and an OCI Runtime
A containerd shim is an execution component that provides a runtime API connection for containerd to send container operations. In the common io.containerd.runc.v2 setup, the shim communicates with containerd and invokes runc, an OCI runtime engine. A shim is not the low-level execution engine itself, and one shim process does not necessarily correspond to exactly one container.
The containerd overview explains how it coordinates image and container lifecycles, while the container runtime overview distinguishes higher-level managers from low-level executors. This article focuses on the connection and responsibilities of the shim between those layers, and where to look when it fails.
How do containerd, the shim, and runc differ?
Starting a container involves preparing image files as a filesystem, setting execution parameters, creating a process, and tracking its status and I/O. containerd Runtime v2 does not require one process to do everything. containerd coordinates requests and metadata; the shim accepts the Runtime v2 service connection; in a separate-engine design, a program such as runc launches the process according to OCI settings.
| Component | Responsibility | What it does not replace |
|---|---|---|
| containerd | Prepares image/filesystem data and coordinates container metadata and execution requests | It generally does not create the low-level container process itself |
| Runtime v2 shim | Opens the service endpoint for containerd and handles task requests, state, and events; depending on the implementation, it invokes an engine and manages I/O or filesystem-mount lifecycle | Not every shim uses runc or has the same internal design |
| Runtime engine | For example, runc creates the container environment using OCI settings and the supplied root filesystem | It does not replace containerd’s image storage or higher-level orchestration |
| kubelet / CRI | In Kubernetes, kubelet asks the node runtime to handle Pod and image operations through CRI | A shim is neither the Kubernetes scheduler nor the CRI plugin |
Separating shim and engine lets containerd keep a runtime communication model while connecting different OCI-compatible engines. However, not every Runtime v2 implementation uses separate shim and engine binaries. A runtime can implement the communication server and execution functions in one program.
How does a start request pass through the shim?
The following simplifies a common Linux containerd-shim-runc-v2 flow. Details and protocols can vary by containerd and shim version.
client or kubelet
│ containerd API / CRI request
▼
containerd
│ prepares bundle and settings; launches runtime shim
▼
shim
│ receives task requests through a Runtime v2 service
│ on a Unix socket (a runc-based shim may invoke runc)
▼
runc → container process
│
└─ exit status and events travel back through the shimA client asks containerd to create a container or task. In Kubernetes, kubelet sends the request through the CRI plugin.
containerd prepares the image filesystem, bundle, and execution settings, then launches the selected Runtime v2 shim.
On Unix-like systems, the shim provides the Runtime v2 API over a Unix-domain socket; on Windows, it uses a named pipe. containerd sends task create, start, stop, and wait requests to that endpoint.
In a separate-engine setup using runc, the shim invokes runc, which creates the actual container process according to the OCI settings.
Task status, exit codes, and events pass through the shim to containerd and the calling client. Cleanup can include deleting the task and unmounting its filesystem.
Runtime v2 asynchronous events need to arrive in order: the task-start event precedes the exit event, so an upstream tool can distinguish “never started” from “started and then exited.” Keep in mind that a shim task state and a CRI or Kubernetes state belong to different layers.
Does one shim handle one container?
Not necessarily. Runtime v2 does not fix the relationship at one-to-one. An implementation may start a new shim for every container or reuse the service address of an existing shim to group multiple containers.
The containerd documentation’s io.containerd.runc.v2 example can group containers from the same Kubernetes Pod using the sandbox ID label supplied by CRI. Therefore, do not infer a leak by simply comparing the number of shim processes with the number of Pods or containers. Other shim implementations and runtime settings can use different grouping policies; check their documentation and the task list.
Why is the shim a separate process?
A shim is more than an alias for calling runc from containerd. A communication path between the higher-level daemon and runtime can allow different execution engines or a separate API service. Some shim implementations also manage task I/O paths or filesystem-mount lifecycles, providing a boundary for detecting container exit and cleaning resources.
The containerd documentation also describes reconnecting to existing shims or cleaning up shims that cannot be reached when the daemon starts. This is possible because the daemon and shim are separate processes; it does not guarantee a disruption-free containerd restart on every platform or runtime. Force-killing a daemon or shim, or manually deleting a shim socket, can desynchronize task and mount state. Follow the platform’s restart and recovery procedure.
What should you check for common symptoms?
The table is a starting point for narrowing down a failure, not a diagnosis. Commands are for a typical Linux systemd node; service names, paths, and log retention vary by distribution and managed Kubernetes environment.
| Symptom | First boundary to check | What to inspect |
|---|---|---|
| “shim binary not installed” or executable not found | Runtime name → shim binary resolution | Compare the runtime name selected by containerd or the CRI runtime handler with the installed binary path. For example, io.containerd.runc.v2 normally maps to containerd-shim-runc-v2. |
| Connection fails right after shim starts | Shim ↔ containerd service address | Check socket/pipe address, permissions, and startup errors in containerd and shim logs. Do not try to fix it by deleting another shim’s socket. |
| Task is created, but container start fails | Shim ↔ engine / OCI bundle | Check the selected engine binary, OCI settings, rootfs, mounts, permissions, and kernel-support errors. |
| Shim process remains visible after a container exits | Task ↔ shim grouping and cleanup | Check whether another task in the same Pod still uses that shim. Do not call it a leak from the process name or count alone. |
Read-only Linux checks can start with:
command -v containerd-shim-runc-v2
ps -eo pid,ppid,args | grep '[c]ontainerd-shim'
sudo journalctl -u containerd --since "15 minutes ago"The binary check searches the current shell’s PATH; it does not prove that the containerd service has the same PATH or runtime-handler configuration. Use logs to distinguish runtime-path resolution from an runc failure after the shim starts. In Kubernetes, also check Pod events and CRI state. Do not manually restart or terminate a shim based only on a symptom; first check the node’s containerd version, runtime handler, and operating policy.
The containerd 2.3 documentation describes a new bootstrap protocol for passing shim startup information; earlier versions used a different flags-and-environment approach. When debugging shim authorship or version-protocol issues, do not apply an old blog’s flags as a universal current procedure. Use Runtime v2 documentation for the containerd and shim versions in use.
Summary
A containerd shim is the Runtime v2 service boundary through which the daemon sends task operations; in a split design it passes requests to an OCI engine. Requests travel from containerd through the shim to an engine such as runc, while status and exit events travel back. Shim count does not have to equal container count: implementations may group tasks, such as by Pod. When troubleshooting, separate binary resolution, socket connectivity, and engine execution, and use version-appropriate recovery steps instead of manually removing processes or sockets.
Sources
[containerd Runtime v2: architecture, usage, and shim lifecycle](https://github.com/containerd/containerd/blob/main/docs/runtime-v2.md)
[containerd Runtime v2 API implementation](https://github.com/containerd/containerd/blob/main/core/runtime/v2/shim.go)
[OCI Runtime Specification: lifecycle and state](https://github.com/opencontainers/runtime-spec/blob/main/runtime.md)
[What Is containerd? How Pod Containers Start on a Kubernetes Node](https://knowledge.linkspot.net/ko/articles/beb71e80-c003-4906-8877-893ebb97d920)
[What Is a Container Runtime? The Execution Layer Between an Image and a Process](https://knowledge.linkspot.net/ko/articles/fae59a9e-db34-41dc-8d15-ae0177edd36d)
The containerd Runtime v2 documentation and related code were checked on 2026-11-23. The article distinguishes the general model from the io.containerd.runc.v2 example. Commands are illustrative, read-only Linux checks and were not run. Details depend on containerd and shim versions, platform, CRI, and runtime configuration.