Difference: 1. containerd does not need to go through dockershim, so the call chain is shorter, and docker needs to go through, so the call chain is longer; 2. docker calls cni "docker-shim", containerd calls cni "containerd- cri".
The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.
What is the difference between containerd and docker
When using k8s, the call chain using docker and containerd is as follows:
It is not difficult to see that when using containerd, the call chain is shorter and there is no need to go through dockershim and docker
Data directory
I believe everyone knows that the default data directory of docker is in the /var/lib/docker directory; when switching to containerd, the data directory defaults to /var/lib/containerd
Log
When we use k8s, if docker is used as the runtime, docker is actually responsible for writing the container program logs to disk. The log files under /var/log/pod and /var/log/container will be soft-linked to the corresponding log files under /var/lib/docker. If you need to configure some parameters for the log, you can directly modify the docker configuration file. ;And if we now use containerd as the runtime, kubelet will be responsible for the placement of container logs. The log files under /var/log/container will be soft-connected to the log files under /var/log/pod. If adjustments are needed Log parameters, you need to modify the kubelet related configuration
CNI
When using docker as the runtime, the docker-shim in the kubelet is responsible for calling cni; and when using containerd as At runtime, the containerd-cri built in containerd is responsible for calling cni
[plugins."io.containerd.grpc.v1.cri".cni] bin_dir = "/opt/cni/bin" conf_dir = "/etc/cni/net.d"
Streaming service
Friends who are familiar with k8s know that commands such as kubectl exec and kubelet log need to be passed The apiserver communicates with the container, which involves streaming services. The docker API itself supports that the docker-shim in kubelet is forwarded through the docker API stream; but containerd needs to be configured separately
[plugins."io.containerd.grpc.v1.cri"] stream_idle_timeout = "4h0m0s" stream_server_address = "127.0.0.1" stream_server_port = "0" enable_tls_streaming = false
Recommended learning: "docker video tutorial"
The above is the detailed content of What is the difference between containerd and docker. For more information, please follow other related articles on the PHP Chinese website!

Use Docker and Kubernetes to build scalable applications. 1) Create container images using Dockerfile, 2) Deployment and Service of Kubernetes through kubectl command, 3) Use HorizontalPodAutoscaler to achieve automatic scaling, thereby building an efficient and scalable application architecture.

The main difference between Docker and Kubernetes is that Docker is used for containerization, while Kubernetes is used for container orchestration. 1.Docker provides a consistent environment to develop, test and deploy applications, and implement isolation and resource limitation through containers. 2. Kubernetes manages containerized applications, provides automated deployment, expansion and management functions, and supports load balancing and automatic scaling. The combination of the two can improve application deployment and management efficiency.

Installing and configuring Docker on Linux requires ensuring that the system is 64-bit and kernel version 3.10 and above, use the command "sudoapt-getupdate" and install it with the command "sudoapt-getupdate" and verify it with "sudoapt-getupdate" and. Docker uses the namespace and control groups of the Linux kernel to achieve container isolation and resource limitation. The image is a read-only template, and the container can be modified. Examples of usage include running an Nginx server and creating images with custom Dockerfiles. common

The reason for using Docker is that it provides an efficient, portable and consistent environment to package, distribute, and run applications. 1) Docker is a containerized platform that allows developers to package applications and their dependencies into lightweight, portable containers. 2) It is based on Linux container technology and joint file system to ensure fast startup and efficient operation. 3) Docker supports multi-stage construction, optimizes image size and deployment speed. 4) Using Docker can simplify development and deployment processes, improve efficiency and ensure consistency across environments.

Docker's application scenarios in actual projects include simplifying deployment, managing multi-container applications and performance optimization. 1.Docker simplifies application deployment, such as using Dockerfile to deploy Node.js applications. 2. DockerCompose manages multi-container applications, such as web and database services in microservice architecture. 3. Performance optimization uses multi-stage construction to reduce the image size and monitor the container status through health checks.

Select Docker in a small project or development environment, and Kubernetes in a large project or production environment. 1.Docker is suitable for rapid iteration and testing, 2. Kubernetes provides powerful container orchestration capabilities, suitable for managing and expanding large applications.

Docker is important on Linux because Linux is its native platform that provides rich tools and community support. 1. Install Docker: Use sudoapt-getupdate and sudoapt-getinstalldocker-cedocker-ce-clicotainerd.io. 2. Create and manage containers: Use dockerrun commands, such as dockerrun-d--namemynginx-p80:80nginx. 3. Write Dockerfile: Optimize the image size and use multi-stage construction. 4. Optimization and debugging: Use dockerlogs and dockerex

Docker is a containerization tool, and Kubernetes is a container orchestration tool. 1. Docker packages applications and their dependencies into containers that can run in any Docker-enabled environment. 2. Kubernetes manages these containers, implementing automated deployment, scaling and management, and making applications run efficiently.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
