In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to analyze Docker mirroring principle in depth. Many people may not understand it. In order to let everyone know more, Xiaobian summarizes the following contents for everyone. I hope you can gain something according to this article.
1.Docker Image Basics 1.1 What is Docker Image
From an overall perspective, a complete Docker image can support the operation of a Docker container, mainly providing a file system perspective during Docker container operation. For example, an image of ubuntu:14.04 provides a basic distribution of ubuntu:14.04 without the Linux kernel.
Having said that, you may need to pay attention to the difference between the Linux kernel and the ubuntu:14.04Docker image. Traditional virtual machine installation ubuntu:14.04 will contain two parts, the first, a Linux kernel distribution, such as Linux version 3.8 kernel; the second, the first specific Ubuntu distribution, this part of the content does not contain the Linux kernel, but contains software management methods outside Linux, software drivers, such as apt-get software management package.
With that in mind, it's easy to understand why it's possible to upgrade a Linux kernel version to 3.18 on top of ubuntu:14.04, which is version 3.8, while ubuntu remains version 14.04. The main one is the difference between the Linux kernel version and the ubuntu operating system distribution.
Linux kernel +ubuntu operating system distribution, make up a working machine for user experience. So flexible replacement ubuntu operating system distribution, that is not also possible to achieve it. Docker conveniently takes advantage of this, and the technical means is Docker imaging.
Docker images are similar to "ubuntu operating system distributions" in Docker architecture and can run on any Linux kernel that meets the requirements. Simply put, there are "Debian OS Distribution"Docker images,"Ubuntu OS Distribution"Docker images; if MySQL 5.6 is installed in the Debian image, we can name it Mysql:5.6 image; if Golang 1.3 is installed in the Debian image, we can name it golang:1.3 image; and so on, you can get any image you want according to your installed software.
So what is the final purpose of mirroring? It's easy to understand that when you go back to running on the Linux kernel and running via mirroring we often refer to the environment provided as a container.
The above content is to see what Docker image is from a macro perspective, and we will further explore Docker image from a micro perspective. Just mentioned that "installing MySQL 5.6 in a Debian image becomes a mysql:5.6 image", in fact, at this time the concept of Docker image hierarchy is reflected. A Debian operating system image at the bottom, superimposed with a mysql layer, completes the construction of a mysql image. The hierarchy concept is not difficult to understand, at this time we generally debian operating system image called mysql mirror layer parent image.
Hierarchical management greatly facilitates the distribution and storage of Docker images. When it comes to distribution, you naturally think of Docker images for flexibility, ease of transfer, and portability. Docker Hub, as a global image repository, as a data warehouse in the Docker ecosystem, brings together Docker data from all over the world and is the lifeblood of the Docker ecosystem.
Docker has two very important technologies, the first is Linux container technology, and the second is Docker image technology. In terms of technology itself, the replicability of both is very strong, and there is no absolute technical difficulty. However, Docker Hub has almost no replicability due to the existence of a large amount of data, which requires an ecological construction.
1.2 Docker image content
This gives you a rough idea of what Docker images are, so let's see what's in Docker images.
Before introducing, let me share with you the changes in my personal understanding of Docker image content during my two years of contact with Docker.
Stage 1: Initial contact with Docker. I believe that many enthusiasts will have the same understanding as me: Docker images represent the file system contents of a container;
Phase II: Initial exposure to the Joint Document System. The concept of federated file systems made me aware of the technique of mirror hierarchy management, where each mirror layer is part of the contents of the container file system.
Third stage: Study the relationship between image and container: container is a dynamic environment, the files in each layer of image belong to static content, but the ENV, VOLUME, CMD and other contents in Docker file need to be implemented into the container running environment eventually, and these contents cannot directly sit in the file system content contained in each layer of image. At this time, each Docker image also contains the relationship between json file records and containers.
Therefore, the content of Docker image mainly consists of two parts: first, the content of the image layer file; second, the json file.
1.3 Docker image storage location
Since it is said that the location of the mirror storage, it should include: mirror layer files and mirror json files. For example, an ubuntu:14.04 image, which contains four mirror layers, in the case of aufs storage drives, can be seen on disk as follows:
1.3.1 View Mirror Layer Composition:
We can view ubuntu: 14.04 by issuing docker history ubuntu: 14.04, and the result is as follows:
1.3.2 Image Layer File Content Storage
The contents of Docker image layer are generally in the aufs path of Docker root directory, which is/var/lib/docker/aufs/diff/. The details are as follows:
The figure shows the contents of the four mirror layers of ubuntu:14.04 and the first-level directories within each mirror layer. An additional note: there is nothing in the mirror layer d2a0ecffe6fa, which is called an empty mirror.
1.3.3 Mirrors json file storage
For each mirror layer, Docker will save a corresponding json file, the storage path of the json file is/var/lib/docker/graph, ubuntu:14.04 The storage path of the json file for all mirror layers is shown as follows:
In addition to the json file, you can see that each mirror layer also contains a layersize file, which records the total size of the file contents inside the mirror layer. Now that we're talking about mirroring json files, to set the stage for what follows, we'll post json files with empty mirror layer d2a0ecffe6fa in ubuntu:14.04:
After reading the above, do you have any further understanding of how to analyze Docker mirroring principle in depth? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.