In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to understand the base image, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Base mirroring is discussed here.
Base image has two meanings:
Build from scratch without relying on other images.
Other images can be extended on the basis of them.
Therefore, what can be called base images are usually Docker images of various Linux distributions, such as Ubuntu, Debian, CentOS, etc.
Let's take CentOS as an example to examine what the base image contains.
Download the image:
Docker pull centos
View image information:
The image size is less than 200MB.
Wait a minute!
Only one CentOS is 200MB?
Usually we install a CentOS has at least a few GB, how is it possible to 200MB!
I believe this is a question that almost all Docker beginners will have, including myself. Let's explain this problem.
The Linux operating system consists of kernel space and user space. As shown in the following figure:
Rootfs
The kernel space is that the bootfs file system is loaded when kernel,Linux starts up, and then bootfs is unmounted.
The user-space file system is rootfs, which contains familiar directories such as / dev, / proc, / bin, and so on.
For base images, the underlying kernel is directly used by Host, and you only need to provide rootfs.
For a simplified OS,rootfs, it can be very small, including only the most basic commands, tools, and libraries. Compared with other Linux distributions, CentOS's rootfs is already bloated, and alpine is less than 10MB.
We usually install CentOS in addition to rootfs will also install a lot of software, services, graphical desktops, etc., it is not surprising that several GB are needed.
The base image provides a Linux distribution with the smallest installation.
The second line of the ADD instruction added to the mirrored tar package is CentOS 7's rootfs. When making an image, the tar package will be automatically extracted to the / directory to generate directories such as / dev, / porc, / bin, etc.
Note: you can view the Dockerfile in the image description page of Docker Hub.
Support for running multiple Linux OS
The main difference between different Linux distributions is rootfs.
For example, Ubuntu 14.04 uses upstart management services and apt management packages, while CentOS 7 uses systemd and yum. These are all user space differences, Linux kernel is not much different.
Therefore, Docker can support multiple Linux images at the same time and simulate a variety of operating system environments.
In the figure above, Debian and BusyBox (an embedded Linux) provide their own rootfs at the upper level and share the kernel of Docker Host at the bottom.
What needs to be explained here is:
The base image is only consistent with the distribution in the user space, and the kernel version is different from the hairstyle version.
For example, CentOS 7 uses 3.x.x 's kernel, and if Docker Host is Ubuntu 16.04 (such as our lab environment), then you are actually using Host 4.x.x 's kernel in the CentOS container.
① Host kernel is 4.4.0-31
② starts and enters the CentOS container
The ③ verification container is CentOS 7
The kernel version of the ④ container is the same as Host
The container can only use Host's kernel and cannot be modified.
All containers share host's kernel, and there is no way to upgrade kernel in the container. If the container has requirements for the kernel version (for example, the application can only run under a certain kernel version), it is not recommended to use the container, which may be more appropriate for virtual machines.
After reading the above, have you mastered how to understand base mirroring? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.