Using containerd with ctr, nerdctl, and crictl: A Practical Guide
This article explains how containerd works as a high‑level container runtime and demonstrates practical usage of its three command‑line clients—ctr, nerdctl, and crictl—for pulling images, managing containers, debugging Kubernetes pods, and performing low‑level runtime operations.
containerd is a high‑level container runtime that manages the full lifecycle of containers on a single host, including creation, start, stop, image pulling, storage, mounts, and networking.
ctr is the native CLI bundled with containerd. It can pull and list images, import Docker images, mount images, run containers, list containers, attach to tasks, execute commands inside containers, and remove containers. Example commands:
$ ctr images pull docker.io/library/nginx:1.21
$ ctr images ls
$ ctr run --rm -t docker.io/library/debian:latest cont1
$ ctr container ls
$ ctr task attach nginx_1
$ ctr task rm -f nginx_1
$ ctr container rm nginx_1nerdctl is a newer, Docker‑compatible CLI for containerd. It supports image building, container network management, and Docker‑style compose workflows, providing a familiar experience for Docker users while leveraging containerd under the hood.
crictl is the CRI‑compatible CLI used to debug Kubernetes nodes. Since containerd includes a built‑in CRI plugin, crictl can manage containers and pods directly. Common commands include pulling images, running pods, executing commands, fetching logs, and gathering statistics.
$ crictl pull docker.io/library/nginx:latest
$ crictl runp pod.yaml
$ crictl exec -it
/bin/bash
$ crictl logs nginx_1
$ crictl statsAll three tools give developers low‑level access to containerd’s capabilities, useful for testing, debugging, and learning the internals of container runtimes.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.