Goodbye Docker: How to Transform to Containerd in 5 Minutes

Goodbye Docker: How to Transform to Containerd in 5 Minutes

Docker is a very popular container technology. There have been many articles saying that it has been abandoned by K8S and replaced by another container technology, containerd! In fact, containerd is just the underlying container runtime separated from Docker, and its use is no different from Docker. This article mainly introduces the use of containerd, and I hope it will be helpful to everyone!

Introduction to containerd

Containerd is an industry-standard container runtime that emphasizes simplicity, robustness, and portability. Containerd can manage the complete container lifecycle in the host, including the transmission and storage of container images, the execution and management of containers, storage, and networking.

Docker vs containerd

Containerd is a project separated from Docker that can be used as a low-level container runtime. Now it has become a better choice for Kubernetes container runtime.

Not only Docker, but many cloud platforms also support containerd as the underlying container runtime. Please refer to the figure below for details.

K8S CRI

K8S released CRI (Container Runtime Interface), which unified the container runtime interface. Any container runtime that supports CRI can be used as the underlying container runtime of K8S.

Why does K8S abandon Docker as the container runtime and use containerd?

If you use Docker as the K8S container runtime, kubelet needs to call Docker through dockershim first, and then call containerd through Docker.

If you use containerd as the K8S container runtime, kubelet can call containerd directly because containerd has a built-in CRI plug-in.

Using containerd not only improves performance (the call chain becomes shorter), but also reduces resource usage (Docker is not a pure container runtime and has a lot of other features).

Use of containerd

If you have used Docker before, you can learn containerd in just 5 minutes. Next, let’s learn how to use containerd.

  • In the previous article "It is said that only high-end machines are capable of running K8S, netizens: The rubbish with 1G memory can run it! 》 We installed K3S. Since K3S uses containerd as the container runtime by default, we can use it as long as we install K3S;
  • In fact, we can operate containerd by simply changing the docker command we used before to the crictl command, for example, to view all running containers;

crictl ps

CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID
4ca73ded41bb6 3b0b04aa3473f Less than a second ago Running helm 20 21103f0058872
3bb5767a81954 296a6d5035e2d About a minute ago Running coredns 1 af887263bd869
a5e34c24be371 0346349a1a640 About a minute ago Running nginx 1 89defc6008501

View all images;

crictl images

IMAGE TAG IMAGE ID SIZE
docker.io/library/nginx 1.10 0346349a1a640 71.4MB
docker.io/rancher/coredns-coredns 1.8.0 296a6d5035e2d 12.9MB
docker.io/rancher/klipper-helm v0.4.3 3b0b04aa3473f 50.7MB
docker.io/rancher/local-path-provisioner v0.0.14 e422121c9c5f9 13.4MB
docker.io/rancher/metrics-server v0.3.6 9dd718864ce61 10.5MB
docker.io/rancher/pause 3.1 da86e6ba6ca19 327kB

Enter the container and execute the bash command. Please note that you can only use the container ID, not the container name.

crictl exec -it a5e34c24be371 /bin/bash

Check the resource usage of applications in the container and you will find that it is very low.

crictl stats

CONTAINER CPU % MEM DISK INODES
3bb5767a81954 0.54 14.27MB 254B 14
a5e34c24be371 0.00 2.441MB 339B 16

Summarize

It is very simple to transform from Docker to containerd, and there is basically no threshold. Just change docker in the previous Docker command crictl and it will be basically done. As expected, they are products produced by the same company and the usage is the same. So no matter whether K8S abandons Docker or not, it has basically no impact on our developers!

This is the end of this article about how to say goodbye to Docker and transform to containerd in 5 minutes. For more information about docker transformation to containerd, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Talk about the issue of replacing docker (shim) with containerd in kubernetes1.20
  • How to keep running after exiting Docker container
  • Docker removes abnormal container operations
  • Docker dynamically exposes ports to containers
  • Delete the image operation of none in docker images
  • Implementation of local migration of docker images
  • Solve the problem of docker images disappearing
  • Docker image cannot be deleted Error: No such image: xxxxxx solution
  • How to delete an image in Docker
  • Naming containers and images in Docker

<<:  Detailed explanation of the problems and solutions encountered in flex multi-column layout

>>:  Similar to HTML tags: strong and em, q, cite, blockquote

Recommend

Detailed explanation of the solution to Tomcat's 404 error

The 404 problem occurs in the Tomcat test. The pr...

Tutorial analysis of quick installation of mysql5.7 based on centos7

one. wget https://dev.mysql.com/get/mysql57-commu...

How to call the interrupted system in Linux

Preface Slow system calls refer to system calls t...

Summary of the differences between count(*), count(1) and count(col) in MySQL

Preface The count function is used to count the r...

How to redirect nginx directory path

If you want the path following the domain name to...

MySQL 8.0.15 compressed version installation graphic tutorial

This article shares the installation method of My...

How to debug loader plugin in webpack project

Recently, when I was learning how to use webpack,...

The difference between Vue interpolation expression and v-text directive

Table of contents 1. Use plugin expressions 2. Us...

Answers to several high-frequency MySQL interview questions

Preface: In interviews for various technical posi...

Front-end state management (Part 2)

Table of contents 1. Redux 1.1. Store (librarian)...

An article teaches you how to implement a recipe system with React

Table of contents 1. Recipe Collection 1.1 Projec...