history
- Docker created containerd originally as a component of its own engine to separate “high-level” management from “low-level” execution.
- Later, Docker donated containerd to the CNCF (Cloud Native Computing Foundation).
- Kubernetes then adopted containerd as its runtime to remove its dependency on the full Docker daemon (the “Docker Shim” removal), because Kubernetes only needed the “running containers” part, not the full Docker UI/Network/Build stack.
So today:
- Docker USES containerd (as its internal engine).
- Kubernetes USES containerd (directly, skipping Docker).
Both tools rely on the same underlying containerd daemon to actually manage processes and images on Linux. If you kill containerd , you break both Docker and Kubernetes on that node.
best practise
change containerd’s default data path
Identify the Current Data Path
1
containerd config default | grep "root" # Expected output: root = "/var/lib/containerd"
Modify the following lines in /etc/containerd/config.toml:
1
root = "/path/to/new/data/path" # the location where container data (images, volumes) is stored
Move Existing Data (if required)
1
2
3sudo systemctl stop containerd # optional
sudo mv /var/lib/containerd /data/containerd
sudo systemctl start containerd
command
image
1 | list k8s image |
container
| Usage Context | Command |
|---|---|
| Default Namespace | ctr container ls |
| Kubernetes Namespace | ctr -n k8s.io container ls |
| Check Process PIDs | ctr task ls |
| Detailed Inspection | ctr container info <id> |
1 | Forcefully stop the task |
nerdctl
Converting your Docker command to containerd requires using either ctr (low-level tool) or nerdctl (Docker-compatible CLI). I strongly recommend using nerdctl as ctr is designed for debugging and lacks many Docker features.
nerdctl provides a Docker-compatible interface and supports the features you need.
1 | list |