This is the ninth day of my participation in the August More text Challenge. For details, see: August More Text Challenge
Life is short. Let’s learn Python
preface
In the previous article, the basic operation of Docker image and container has been introduced. There may be some friends who have questions. Docker is a lightweight, so why are some images particularly large? You need to understand the layering principle of Docker image. When using the docker pull command, it will first look for the image in the local repository. If it cannot be found, it will download the image in the remote repository. However, it can be downloaded first.
Principle of mirror stratification
First, let’s look at the official definition of an image. An image is a lightweight, self-contained package used to package a software runtime and software developed based on it. It contains everything a software needs, including code, runtime libraries, environment variables, and configuration files.
Containers are isolated at the operating system level. Containers are created by running images. If you build images in this way, each image needs to encapsulate a basic operating system dependency.
Therefore, Docker extracts the public part of the image separately for layering as far as possible, and makes the division more detailed as possible. The lowest part is the most public part of the image. The figure above can be simply translated as follows: of course there may be further layers at the operating system level.
So in summary, the reason an image is so large is that an image is not only the original package, but also the operating system dependencies that the package requires, the group itself, and its own package composition.
When Docker designs images, each image is composed of N images, which will reuse the basic repeated images to the maximum extent, thus reducing the overall volume of the warehouse. This is also the image hierarchy principle, also known as UnionFs federated file system.
Docker core architecture
After understanding related operations of image and container, we can summarize the core architecture diagram of Docker, which can help us learn More clearly about Docker. (Dockerfile will be introduced in a later article, welcome to pay attention to oh)
conclusion
The article was first published in the wechat public account program Yuan Xiaozhuang, synchronized with nuggets.
Please explain where it came from. If you pass by, please put out your cute little finger and click like before you go (╹▽╹)