In this post weāll cover the basics of container runtimes, and dive deeper into Containerd.
Container Runtimes:
Simply said, container runtimes are software that facilitate the containers to run. Historically, there were many runtimes that used to have their own formats of containers. This approachĀ has proven to be difficult as the users donāt have the ability to adopt new container runtimes or port from existing ones with ease.
The Open Container Initiative:
A bunch of tech giants came together to form The Open Container Initiative, which has defined some standards in theĀ container ecosystem that has enabled the users to work with different runtimes with a standard OCI format.
Many of the container runtimes can now work with OCI standards. Due to this standardization, many new container runtimes are getting the support they werenāt getting before this standardization.
Before talking about Containerd:
There are two levels of container runtimes: high-level container runtimes and low-level container runtimes. Containerd is a high-level container runtime that uses Runc (a low-level container runtime) by default, but can be configured to use others as well.

Containerd:
According to the official GitHub repoĀ āContainerd is an industry-standard container runtime with an emphasis on simplicity and robustness and portability.ā
Since, I donāt want to copy and be done with it, I would like to define it this way: āContainerd is one of the most extensible, well-architected and optimal runtimes focused on simplicity that is meant to be embedded into a larger ecosystem.ā
To be clear, and before we start,Ā Containerd does not build images; it just consumes them. For a clearer picture, check out the scope of Containerd in the official Github repo.
Containerd History:
The Containerd is born out of the monolithic Docker, and is included in Docker,Ā from Docker 1.11.
Kubernetes supports the use of Containerd as a runtime from Kubernetes 1.10 and above.

Letās get to Command line
Installation:
Follow the official docs for installing Containerd; or if youāre using Ubuntu, just install Containerd with apt.
Interacting with Containerd:
Since, the official docs for Containerd use the client package to get you started, weāll stick to the ctr tool in this article. The ctr tool is easier to get started for beginners because they donāt have toĀ bother with code.
Demo:
Once youāve installed Containerd, follow along with the commands listed below.
In this Demo weāll see how we could use the ctr tool to interact with Containerd to manage and run containers. Weāll fetch the hello-world image, run a container with that image, delete that image and, finally, delete the container as well.
#ctr

As you see this is quite powerful and you can do a lot with it.
Letās start by pulling an image
# ctr image pull docker.io/library/hello-world
This would give you an error saying you missed an object, because Containerd requires you to specify the object like the command below:
# ctr image pull docker.io/library/hello-world:latest
You can replace object with whatever is available like āalpineā
Letās try listing the image to confirm
# ctr image ls
This can be a bit unfriendly, so try the following command:
#ctr image ls -q
The above command will give only the image name and nothing else.
Now that weāve got our image, we need to run a container.
#ctr container create docker.io/library/hello-world:latest demo
This would create a container with container id, ādemoā, based on the image that we pulled.
There are a few things to notice here: The output is not redirected to the CLI by default. Unlike Docker, we need to use the full path with the object every time we use a container image. Also, the image needs to be pulled before being able to run a container.
We can list the containers created with the command below:
#ctr container list
You can see the demo container listed. You can even use -q to get just the container names.
Now to delete the image.
#ctr image remove docker.io/library/hello-world:latest
This would delete the image. What would happen to your container?
#ctr container list
Your container would still be running. This is because containerd works on references, and in this case, the image is no longer being referenced as an image but it is still being referenced by the container (as a snapshot), so it wouldnāt be deleted as long as itās being referenced.
Youāll get a better picture when learning about snapshots, which would be a topic for another article.
For now, weāll delete the image.
#ctr container remove demo
Please leave a comment with any suggestions.
References:
You can use the below links to explore further:
https://opencontainers.github.io/org/introduction
https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/


