containerd Cheatsheet

Last Updated: 2024-03-03
# containerd view logs
$ journalctl -u containerd

ctr vs crictl:

  • ctr: containerd CLI, not related to k8s.
  • crictl: CRI Compatible container runtime command line interface, related to k8s.

crictl image = ctr -n=k8s.io images ls

kind load uses "ctr", "--namespace=k8s.io", "images", "import", "--digests", "--snapshotter="+snapshotter, "-"

what's in containerd config

Config file: /etc/containerd/config.toml

  • sandbox_image (you can overwrite the pause image)
  • default runtime, e.g. "runc"
  • registry auth/ca/mirrors


version = 2

   config_path = "/etc/containerd/certs.d"

Per registry config:

$ tree /etc/containerd/certs.d
└── docker.io
    └── hosts.toml

Check number of sandboxes and containers

# check the number of pod sandboxes:
$ ls /var/lib/containerd/io.containerd.grpc.v1.cri/sandboxes/ | wc -l

# check the number of containers
$ ls /var/lib/containerd/io.containerd.grpc.v1.cri/containers/ | wc -l