If you have operated Kubernetes since the 1.20 era, you watched the Docker shim deprecation unfold in real time. One day docker ps showed you everything on the node, the next you were told the kubelet would no longer talk to Docker directly. In my experience, that transition confused more teams than it should have, largely because container runtimes were treated as a black box. Understanding what containerd and CRI-O actually do, how they both implement the OCI standards, and where they diverge operationally is essential for anyone running production clusters. This is not theory — your choice of runtime affects pod startup latency, image pull behavior, storage drivers, debuggability, and even how you harden your nodes.
How the Kubelet Talks to Runtimes: The CRI Abstraction Layer
Before the Container Runtime Interface (CRI) existed, the kubelet had hard-coded support for Docker via dockershim, a bridge that translated internal kubelet calls into Docker Engine API calls. This created a tight coupling that prevented alternative runtimes from integrating cleanly and forced the Kubernetes project to maintain Docker-specific logic. The CRI solved this by defining a vendor-neutral gRPC API that the kubelet uses to manage pods, containers, and images. Today, the kubelet is a CRI client; containerd and CRI-O are CRI servers.
The CRI defines two primary gRPC services: RuntimeService and ImageService. When you run kubectl run nginx --image=nginx:1.25, the kubelet does not create a container itself. It sends a RunPodSandbox request to create the pod-level sandbox (the pause container that holds namespaces and cgroups), then a series of CreateContainer and StartContainer calls for each container inside that sandbox. Image pulls go through PullImage on the ImageService. This separation is why you can swap runtimes without changing your workloads — the API contract is stable.
The CRI gRPC Contract in Practice
In my clusters, I rarely debug the kubelet directly. Instead, I use crictl, the CRI-compatible CLI that speaks the same gRPC socket as the kubelet. It works identically whether the underlying runtime is containerd or CRI-O, which is invaluable when Docker is no longer present on the node.
# Point crictl at the runtime socket - path depends on your runtime
# containerd default: /run/containerd/containerd.sock
# CRI-O default: /run/crio/crio.sock
crictl --runtime-endpoint unix:///run/containerd/containerd.sock ps -a
crictl --runtime-endpoint unix:///run/containerd/containerd.sock pods
crictl --runtime-endpoint unix:///run/containerd/containerd.sock images
# Inspect a failing pod sandbox in detail
crictl inspectp $(crictl pods --name nginx --latest -q)
If you are still relying on docker commands on your Kubernetes nodes, you are inspecting the wrong daemon. Once dockershim was removed in Kubernetes 1.24, the Docker Engine is no longer involved in pod lifecycle at all. According to the Kubernetes Documentation, CRI is now the only supported interface for the kubelet, and every CNCF-conformant distribution defaults to either containerd or CRI-O. I've found that teams who standardize on crictl and ctr (for containerd specifics) during incident response cut their mean time to diagnosis significantly.
Inside containerd: Architecture, Shimv2 and Snapshotter Design
containerd started as the core container supervisor inside Docker Engine. Donated to the CNCF, it was refactored into a standalone daemon focused on lifecycle management: pulling images, managing storage and snapshots, executing containers via OCI runtimes, and handling networking via CNI. It is not a monolith that tries to do everything. Instead, it exposes a gRPC API and relies heavily on plugins.
The architecture is layered. At the top, the CRI plugin (cri) implements the Kubernetes CRI service and translates those calls into internal containerd operations. Below that are services for content store, snapshotter, metadata, and execution. The actual process of starting a container is delegated to an OCI runtime — almost always runc — but containerd does not keep that process as its child. That responsibility belongs to the shim.
From gRPC API to runc Execution: The Shimv2 Model
Early versions of containerd used a single long-lived shim process. Shimv2 changed this to one shim per container. When containerd is asked to start a container, it launches a containerd-shim-runc-v2 binary, which then forks and execs runc create/start. The shim becomes the parent of the container process, handles stdio, manages reaping, and reports exit codes back to containerd over a private API. If containerd itself restarts or crashes, the containers keep running because their parent is the shim, not the daemon. I've recovered nodes where containerd was OOM-killed and all pods remained serving traffic — that isolation is only possible because of this design.
Snapshotter Plugins and Layer Management
containerd does not hardcode how layers are stored. It uses pluggable snapshotters. The default overlayfs snapshotter stacks layers using the kernel's overlay filesystem, which is fast and mature on modern distributions. But there are also btrfs, zfs, devmapper, and more experimental ones like stargz for lazy-pulling and nydus for distribution of large images. This pluggability matters when you run I/O-heavy workloads or want to reduce pod startup time for multi-gigabyte images. You configure the snapshotter in /etc/containerd/config.toml:
# /etc/containerd/config.toml snippet
version = 2
[plugins."io.containerd.grpc.v1.cri".containerd]
snapshotter = "overlayfs"
default_runtime_name = "runc"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
runtime_type = "io.containerd.runc.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
# Enable stargz for lazy pull (requires additional setup)
# snapshotter = "stargz"
The SystemdCgroup = true setting is one I enforce on every production cluster. When set to false, containerd uses cgroupfs, which creates a mismatch with systemd-managed kubelet cgroups and leads to unstable CPU throttling and systemd warnings under load. This is a common misconfiguration I see in clusters bootstrapped with default tooling. If you are building optimized images to benefit from snapshotter efficiency, the principles in Dockerfile Best Practices: Multi-Stage Builds, Layer Caching and Security still apply directly, since containerd ultimately consumes the same OCI image layers.
CRI-O: Purpose-Built Minimalism for Kubernetes Workloads
Where containerd evolved from a general-purpose container daemon, CRI-O was designed from day one to be a lightweight, Kubernetes-only runtime. The project, started by Red Hat, has a single goal: implement the CRI and nothing else. It does not build images, it does not push images, it does not provide a standalone CLI like docker build. It pulls, runs, and removes containers as Kubernetes instructs.
This minimalism is deliberate. CRI-O delegates every OCI-compliant operation to dedicated components: runc (or crun) for runtime execution, conmon for monitoring and logging, and containers/storage and containers/image libraries for storage and image management. The daemon itself is intentionally small, which reduces the attack surface and makes security audits more straightforward.
Daemon Design Without Image Building
Because CRI-O does not handle image building, your CI pipelines must produce OCI images elsewhere — typically with Buildah, Podman, Kaniko, or Docker. CRI-O then pulls from a registry using the same containers/image logic as Podman. This separation enforces a cleaner supply chain: nodes never need build privileges or Docker socket access. In environments subject to strict compliance requirements, I prefer CRI-O precisely because there is no build path to accidentally expose on a worker node.
CRI-O also integrates more naturally with systemd and defaults to systemd cgroups. Its configuration lives in /etc/crio/crio.conf and drop-ins under /etc/crio/crio.conf.d/. A key operational difference is that CRI-O respects the /etc/containers/registries.conf configuration for registry mirrors, search registries, and insecure registries, rather than containerd's TOML mirrors configuration. I've found that teams running OpenShift or Fedora CoreOS gravitate toward CRI-O because it shares the same libraries and operational model as the rest of the RHEL ecosystem, simplifying OS-level patching and FIPS compliance.
Logging is another distinction. containerd handles logs internally via the CRI plugin, while CRI-O delegates to conmon, a tiny C program that holds the container's stdio and writes to the log file Kubernetes expects at /var/log/pods/<pod>/<container>/<n>.log. If conmon dies, the container is not affected, but log collection will stall — a failure mode to monitor if you use CRI-O with a DaemonSet log forwarder.
The OCI Trinity: Runtime Spec, Image Spec and Distribution Spec
Both containerd and CRI-O are interchangeable at the Kubernetes level because they adhere to the Open Container Initiative (OCI) specifications. Without OCI, each runtime would define its own bundle format and image layout, and portability would collapse. The OCI defines three specs that form a contract between build tools, registries, and runtimes.
The Image Spec defines how to package an image: a JSON manifest that references a config blob and a set of layer tarballs identified by content-addressable digests (sha256). Each layer is a diff, and the config contains execution metadata like entrypoint, env, and architecture. When you run crictl pull nginx:1.25, you are fetching this manifest and layers per the Image Spec.
The Runtime Spec defines how to execute a container from a filesystem bundle. A bundle is a directory containing a config.json that describes namespaces, cgroups, capabilities, mounts, and the process to exec, plus a rootfs directory that is the merged layer filesystem. runc implements this spec directly. Both containerd and CRI-O prepare this bundle on disk and then call runc create.
config.json and the Runtime Filesystem Bundle
To see the spec in action, you can manually create a bundle with runc. This is exactly what your runtime does under the hood for every pod:
# Create a bundle from an OCI image using skopeo and umoci (debugging only)
mkdir -p /tmp/bundle/rootfs
skopeo copy docker://docker.io/library/alpine:latest oci:/tmp/alpine-oci:latest
umoci unpack --image /tmp/alpine-oci:latest /tmp/bundle
# Inspect the generated OCI Runtime Spec
cat /tmp/bundle/config.json | head -n 60
# Contains: ociVersion, process.args, process.env, linux.namespaces, mounts, etc.
# Run it directly via runc (no Kubernetes involved)
runc --root /run/runc run my-test-container
The third spec, the Distribution Spec, standardizes the registry API for pushing and pulling those images (the HTTP endpoints under /v2/). This is why you can push an image built with Docker to a registry and pull it on a CRI-O node without conversion. In practice, this interoperability is what allows you to adopt multi-stage builds and distroless images without worrying about the underlying runtime. The Docker Documentation now explicitly notes that its image output is OCI-compliant, which guarantees compatibility with both containerd and CRI-O as long as you avoid Docker-specific manifest extensions.
If you are templating deployments that rely on specific image metadata, remember that Kubernetes does not parse Dockerfile semantics. It only sees the OCI config. Misunderstandings here — such as expecting shell expansion of ENTRYPOINT or assuming VOLUME creates a persistent directory — cause runtime errors that look like kubelet failures but are really OCI config misinterpretations.
containerd vs CRI-O in Production: Performance and Operational Trade-offs
When choosing between containerd and CRI-O for a production fleet, the functional difference is smaller than many vendors suggest. Both pass CRI conformance tests and run the same OCI bundles via the same runc. The decision comes down to operational footprint, ecosystem alignment, and lifecycle management.
containerd has broader adoption across managed Kubernetes services — GKE, EKS, and AKS all default to containerd — and therefore benefits from wider community tooling, more extensive documentation, and faster reponse to upstream CVEs. Its CLI tools ctr and crictl are well-known, and its plugin system lets you extend functionality without forking. I typically deploy containerd on clusters where I need features like Nydus lazy pulling for large AI images or where the platform team already automates node provisioning with cloud-init that assumes containerd.
CRI-O shines in environments that prioritize minimalism, RHEL/OpenShift compatibility, or security certifications. Its daemon is smaller, it has fewer exposed APIs, and it shares storage libraries with Podman, which simplifies image verification with sigstore and policy-based pull controls via containers/policy.json. I've found CRI-O upgrades to be slightly more predictable because there is less state to migrate — it was built to be stateless and reconstructible.
From a performance standpoint, pod startup latency is nearly identical when both use runc and overlayfs. Differences emerge under high churn (thousands of pod creates/deletes per hour) where CRI-O's use of conmon versus containerd's internal log handling can show different CPU profiles. Neither is universally faster; you should benchmark with your actual pod spec and image sizes rather than trusting vendor graphs. For autoscaling workloads where startup time matters, your image size and registry proximity dominate runtime overhead. Tuning your scaling strategy as described in Kubernetes Autoscaling: HPA, VPA and KEDA for Event-Driven Scaling will have a far larger impact than switching runtimes.
| Attribute | containerd | CRI-O |
|---|---|---|
| Primary Use Case | General-purpose container lifecycle (Kubernetes + standalone) | Kubernetes-only, minimal CRI implementation |
| Daemon Scope | gRPC service with extensible plugin system | Narrow daemon, delegates to runc/crun + conmon |
| Image Build | No (but has ctr import/build via BuildKit) | No (requires external builder: Buildah, Podman) |
| Storage & Image Libs | Internal snapshotters and content store | containers/storage + containers/image |
| Cgroups Default | cgroupfs (must set SystemdCgroup=true) | systemd (native) |
| Default Socket | /run/containerd/containerd.sock | /run/crio/crio.sock |
| Ecosystem Alignment | Docker, GKE/EKS/AKS, generic Linux | OpenShift, Podman, RHEL/Fedora CoreOS |
My default recommendation is simple: if you run a vanilla or cloud-managed distribution, stay with containerd unless you have a specific reason to use CRI-O. If you run OpenShift or your OS team standardizes on Podman, CRI-O will integrate more cleanly with your host hardening and registry policies. Avoid running both in the same fleet without automation to manage the divergent config paths — the operational cost of two runtimes outweighs any theoretical benefit.
Debugging Runtime Failures When Pods Refuse to Start
When a pod is stuck in ContainerCreating or shows CrashLoopBackOff with no application logs, the failure is often below Kubernetes. The kubelet reports events like Failed to create pod sandbox or Failed to create container, which indicate the CRI call failed. In my experience, 80% of these cases fall into four categories: image pull errors, CNI misconfiguration, runtime config drift, or OCI spec violations.
Start by checking the kubelet and runtime logs on the node, not just kubectl describe pod. For containerd, look at journalctl -u containerd and journalctl -u kubelet. For CRI-O, check journalctl -u crio and journalctl -u conmon if logs are missing. Then use crictl to bypass the API server:
Step-by-Step Node-Level Triage
First, verify the sandbox exists. If crictl pods shows no sandbox for your pod UID, the failure is in RunPodSandbox — usually CNI or cgroup setup. Second, if the sandbox exists but crictl ps -a shows no container, inspect the sandbox logs with crictl logs --tail 50 <container-id> and check the runtime's error message in kubelet.log. Common causes I see include:
1. Image pull backoff due to registry auth or rate limiting: containerd and CRI-O cache pull failures differently. containerd will respect imagePullSecrets but requires mirror configuration to be in /etc/containerd/config.toml under [plugins."io.containerd.grpc.v1.cri".registry.mirrors], while CRI-O uses /etc/containers/registries.conf. A mismatched mirror entry causes silent fallback to the upstream registry and then throttling. Validate with crictl pull --creds user:pass my-registry.example.com/app:tag on the node.
2. CNI binary missing or network namespace leak: Both runtimes delegate networking to CNI. If the CNI plugin binary is not in /opt/cni/bin or the config in /etc/cni/net.d is invalid JSON, RunPodSandbox will fail with failed to setup network for sandbox. This often happens after an OS upgrade that wipes /opt. Your pod networking will also affect service discovery, so after fixing the runtime, verify that Kubernetes Networking: Services, Ingress Controllers and Network Policies are reconciled correctly.
3. Config drift after node bootstrap: Tools like kubespray or kubeadm generate containerd configs that may not match your desired SystemdCgroup or default_runtime_name. After any node rebuild, diff the generated config against your golden file and restart the runtime before joining the cluster. I automate this with a preflight check that fails node provisioning if the runtime config checksum does not match.
When you need low-level visibility, enable containerd debug metrics or CRI-O tracing. containerd exposes Prometheus metrics on 127.0.0.1:1338/v1/metrics including snapshotter latency and CRI operation durations. CRI-O exposes similar data via its metrics port. These signals help distinguish application crash loops from runtime throttling under disk pressure — a distinction kubectl alone will not show.
Frequently Asked Questions
Can I run Docker Engine alongside containerd or CRI-O on a Kubernetes node?
Technically yes, but I do not recommend it in production. Docker Engine bundles its own containerd instance, and running two daemons that manage overlayfs and CNI on the same host causes confusion, duplicated image storage, and port conflicts if you expose the Docker socket. If you need Docker for CI builds, run it on separate build nodes or use rootless Podman/BuildKit. Kubernetes no longer requires Docker on worker nodes.
Do I need to change my Dockerfiles or images when switching from Docker to containerd or CRI-O?
No, if your images are built as OCI-compliant images. Both containerd and CRI-O pull and run the same OCI Image Spec layers and config that Docker produces. You only need changes if you relied on Docker-specific behaviors such as legacy manifest v1, Docker Content Trust signatures without sigstore translation, or assumptions about how docker build handles ARG interpolation. Test your images with crictl pull and runc spec validation before migrating a fleet.
How do I choose between runc and crun as the OCI runtime?
Both implement the OCI Runtime Spec. runc is the reference implementation written in Go and is the default for both containerd and CRI-O. crun is written in C, starts containers measurably faster, and uses less memory per container, which helps in high-density or edge scenarios with thousands of short-lived pods. In containerd, set runtime_type to io.containerd.runc.v2 for runc or use the crun binary with the same type; in CRI-O, change default_runtime to crun in crio.conf. Validate with your workload — crun is stable, but some proprietary security agents still expect runc process names.
Why does crictl show containers that kubectl does not?
crictl talks directly to the CRI socket and shows all sandboxes and containers the runtime knows about, including system pods, exited containers not yet garbage-collected, and pods in stages before they are reported to the API server. kubectl only shows objects that the kubelet has successfully reported to the control plane. The extra entries in crictl are usually terminated pods awaiting GC based on your kubelet's --image-gc-high-threshold and container GC settings, or static pods defined in /etc/kubernetes/manifests. Use crictl rm and crictl rmp only for manual cleanup during incidents, not routine operation.