This is the fourth day of my participation in the November Gwen Challenge. See details: The last Gwen Challenge 2021.

I’m sure you know HelloWorld, which is the most classic example of getting started in any programming language. And Docker is no exception.

Start the HelloWorld container

Use docker run –help to start the container.

Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...
Copy the code

Hello – world start:

Analysis of the

The hell-world container can be started by executing docker run hello-world, but since we don’t have a local image of hello-world, Docker automatically searches for and downloads the hello-world image from the remote repository.

View the hello-world image pulled down

Root @ phyger - VirtualBox: / home/phyger# docker images | grep hello hello - world latest bf756fb1ae65 may have a line 13.3 kB root@phyger-VirtualBox:/home/phyger#Copy the code

We found that this image is only 13.3KB, which is extremely small, but it is a complete Docker container image.

Docker then starts the Hello-world container with the Hello-world image and prints Hello from Docker!

Hello from Docker!
This message shows that your installation appears to be working correctly
Copy the code

Finally, the container finishes running, printing out the entire startup process of the container.

View the container at the end of the run:

root@phyger-VirtualBox:/home/phyger# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
c3d23ead2fc6        hello-world         "/hello"            6 seconds ago       Exited (0) 4 seconds ago                       sharp_sinoussi
root@phyger-VirtualBox:/home/phyger#
Copy the code

Why is the container in Exited state after it finishes running? Continue in the next chapter

Container operation schematic

Containerd is installed and used

The installation

Download package

The tar wget https://github.com/containerd/containerd/releases/download/v1.5.7/cri-containerd-cni-1.5.7-linux-amd64.tar.gz - ZXVF cri - containerd - the cni - 1.5.7 - Linux - amd64. Tar. GzCopy the code

Delete unnecessary files

rm -rf etc/cni
rm -rf opt
Copy the code

Start the containerd

ystemctl status containerd
systemctl enable containerd
systemctl restart containerd
Copy the code

Generate the default configuration file

Containerd config default > / etc/containerd/config toml modify configuration files: oom_score = - 999Copy the code

Start the HelloWorld container

Because Containerd does not pull images from docker’s repository by default, we specify the source to do this.

ctr i pull docker.io/library/hello-world:latest
ctr run -d -t docker.io/library/hello-world:latest
Copy the code

View the hello-world container launched:

ctr c ls

Use CTR –help to view more commands.