Docker learning (3) the startup process of the container

Summary: In this section, let's learn a little about the principle of docker. docker run -i -t ubuntu /bin/bash Enter the above command to start a ubuntu container. What happened? The general process can be described by the following figure: First of all, the system must have a background process of docker daemon running. When the command is typed just now, 1. In

this section, we will learn a little about the principle of

docker docker run -i - t ubuntu /bin/bash
Enter the above line of command to start a ubuntu container, what happened?

The general process can be described by the following figure:



First, the system must have a background process of docker daemon running. When the command is typed just now,

1. docker client (ie: docker terminal command line) will call docker daemon to request to start a container ,

2. docker daemon will request the host os (ie: linux) to create a container

3. linux will create an empty container (which can be simply understood as: a bare metal without an operating system installed, only virtualized CPU, memory and other hardware resources )

4. docker daemon, please check whether there is a docker image file on the machine (it can be simply understood as an operating system installation CD), if so, load it into the container (ie: insert the CD into the bare metal, ready to install the operating system)

5. Put the image file Loaded into the container (ie: the operating system is installed on the bare metal, it is no longer a bare metal state)

Finally, we get a ubuntu virtual machine, and then we can perform various operations.



If it is found that the file does not exist when checking the local image file in step 4, it will go to the default docker image registry (ie: docker hub website) to download it online. After the download comes back, it will be loaded into the container, that is As shown in the figure below



, there is also a picture on the official website that vividly describes this process:



Reference article:

https://www.gitbook.com/book/joshhu/docker_theory_install/details

https://docs.docker.com/engine/ introduction/understanding-docker/

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326100356&siteId=291194637