Cloud Native 9 min read

Why Switch from Docker to containerd? A Hands‑On Guide to Installing and Using containerd

This article explains Kubernetes' deprecation of Docker, introduces containerd as a lightweight, industry‑standard runtime, and provides step‑by‑step instructions for installing, configuring, and operating containerd on Linux, including common CLI commands for managing images and containers.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Why Switch from Docker to containerd? A Hands‑On Guide to Installing and Using containerd

Kubernetes Docker Deprecation

Starting with Kubernetes v1.20, Docker support in the kubelet is deprecated and will be removed in future releases. Since Docker’s container management is implemented by containerd, migrating to containerd is the recommended path.

Containerd Overview

Containerd originated inside Docker Engine and has been extracted as an independent open‑source project that provides a stable, portable container runtime. It manages the full container lifecycle: image transfer and storage, container execution, networking, and storage.

Repository: https://github.com/containerd/containerd/

Architecture

Containerd runs as a daemon exposing a gRPC API over a local UNIX socket. The architecture consists of the following core components:

Storage – handles image metadata, storage, and retrieval.

Task – manages container logical structures and interacts with low‑level runtimes.

Event – publishes container events for subscribers.

Runtimes – low‑level runtimes such as runc.

Capabilities

Manage the complete container lifecycle (create → destroy).

Pull and push container images.

Store image and container data.

Invoke runc (or other OCI runtimes) to run containers.

Manage container network interfaces and networking.

From a Kubernetes perspective, using containerd shortens the call chain, reduces component count, improves stability, and consumes fewer node resources.

Installation

Download URL: https://containerd.io/downloads/

# wget https://github.com/containerd/containerd/releases/download/v1.5.2/containerd-1.5.2-linux-amd64.tar.gz
# tar zxf containerd-1.5.2-linux-amd64.tar.gz -C /usr/local/

Generate the default configuration file:

# containerd config default > /etc/containerd/config.toml

Systemd Service Configuration

[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target

[Service]
ExecStartPre=/sbin/modprobe overlay
ExecStart=/usr/local/bin/containerd
Delegate=yes
KillMode=process
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity

[Install]
WantedBy=multi-user.target

Reload systemd and start the service:

# systemctl daemon-reload
# systemctl start containerd.service
# systemctl status containerd.service

Using containerd

The lightweight Kubernetes distribution K3s bundles containerd, Flannel, and CoreDNS by default. ctr – native CLI for containerd. crictl – Kubernetes‑specific CLI for container runtimes.

Check the version:

# ctr version
Client:
  Version:  v1.5.2
  Revision: 36cc874494a56a253cd181a1a685b44b58a2e34a
Server:
  Version:  v1.5.2
  Revision: 36cc874494a56a253cd181a1a685b44b58a2e34a

List containers and delete one:

# ctr container list
CONTAINER  IMAGE                         RUNTIME
nginx       docker.io/library/nginx:alpine io.containerd.runc.v2
# ctr container del nginx
# ctr container list

Pull an image and list images:

# ctr images pull docker.io/library/nginx:alpine
# ctr images list

Run a container:

# ctr run -d docker.io/library/nginx:alpine nginx
# ctr container list

All commands are analogous to Docker, so the learning curve remains minimal after Docker support is removed from Kubernetes.

For detailed usage, refer to the official containerd documentation.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

CLIKubernetesRuntimeLinuxcontainerd
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.