Docker vs. Containerd

Krupakar Reddy
3 min readApr 22, 2022

Here i would like to share my knowledge about Docker and Containerd.
Since we all know that in today’s application world, we thoroughly hear about containers to run an applications code.
Docker is a containerised tool which performs the packing of an application code into an image. With the help of an image we will create a container with required dependencies that what application requires to run.

Here we know usage of docker. But actually docker has an internal layers to perform all this building an image, creating a container with an image etc etc..

relation between docker, containerd and runc.

Here we can see that, docker internally itself consists of containerd for container runtime purpose. By default installing of docker will make install of containerd instantly.

Docker is from client side tool for using commands and where containerd is looking on for pulling image, allocates the resources for a container runs and serves an applications.

Also containerd can be considered as high level run-time and resource manager for managing container process, images, snapshots, container metadata and dependencies..
runc, which is a low level run-time used to create and run the containers.

containerd was split out from docker in the year 2016 to allow other container ecosystems such as kubernetes, AWS Fargate and more.

CRI : Container Runtime Interface which is an API that allows K8S to run conatiners and contianerd interface with CRI, Hence Kubernetes or docker can use it, and CRI uses runc defaultly to implement CRI interface.

CRI-O which was built for kubernetes to replace docker service as container engine.

Containerd can be used directly without dependent of docker.

Here we see installation of containerd and perform initial container run also.

Installation steps of Containerd on Ubuntu OS.

sudo apt-get update
sudo apt-get install containerd -y

once we done with above command, containerd will get installed and check the version with command ctr --version. Then we able to see version of ctr.

The basic commands for ctr cli are:
ctr image ls , ctr container ls to check image list and container list respectively.

ctr image pull docker.io/library/nginx:latest to pull an nginx image. In the containerd we shall mention tag for an image, otherwise ctr image pull will object to pull an image.

ctr run docker.io/library/nginx:latest nginx is used to run a container.

Note: In docker by default, it generates unique container ID, whereas in containerd, we shall supply the container id., In the above case we passed nginx as container id after image tag.

Few more points to be noted that, containerd has lack of ability in publishing ports, restart = always policy, logs of containers, build of an images.
Unlike docker, containerd cannot pull image directly from remote repository if it is unavailable in local machine.

Features of Containerd:
→ Supportable to all leading container orchestrators.
→Committed to stable API such as CRI.

To know better cli than ctr , we must to know about nerdctl.

--

--