current position:Home>Docker learning (IV) docker image
Docker learning (IV) docker image
2022-01-26 23:44:48 【Xiao, ry】
What is a mirror image
Image is a lightweight 、 Executable standalone package , It is used to package software running environment and software developed based on running environment , It contains the content needed to run a software , Including code 、 Runtime 、 library 、 Environment variables and profiles .
UnionFS( Federated file system )
UnionFS ( Federated file system ) : Union file system (UnionFS) It's a kind of layering 、 Lightweight and high performance file system , It supports the modification of the file system as a stack of layers submitted at one time , At the same time, you can mount different directories to the same virtual file system (unite several directories into a singlevirtualfilesystem).Union The file system is Docker The foundation of the mirror . Images can be inherited by layering , Based on the basic image ( No father image ) Can make a variety of specific application image .
characteristic : Loading multiple file systems at once , But from the outside it looks like , Only one file system can be seen , Joint loading will stack up all layers of file systems , In this way, the final file system will contain all the underlying files and directories
Docker Image loading principle
docker The image of is actually composed of file systems layer by layer , This hierarchical file system is UnionFS.
bootfs(boot file system) It mainly includes bootloader and kernel, bootloader Mainly boot loading kernel, Linux It will load when it is just started bootfs file system , stay Docker The bottom of the image is bootfs. This floor is typical of Linux/Unix The system is the same , contain boot Loader and kernel . When boot After loading, the whole kernel is in memory , At this time, the right to use the memory has been bootfs To the kernel , The system will also uninstall bootfs.
rootfs (root file system), stay bootfs above . Contains typical Linux In the system **/dev, /proc, /bin, /etc Etc. standard directories and documents .rootfs Is a variety of different operating system distributions , such as Ubuntu**,Centos wait .
The number of virtual machines we usually install Centos There are several G , Why? docker It's here 230m
For a streamlined OS, rootfs It can be very small , Just include the most basic commands 、 Tools and libraries will do , because The bottom layer directly uses Host Of kernel, You only need to provide rootfs That's it . about Different linux Distribution version , bootfs Basically consistent , rootfs There will be differences , So different distributions can be shared bootfs.
Layered mirror
Looking at the image, you can see tomcat A very large , Yes 680M, Why is that ?
because tomcat You need to install jdk8, and jdk8 Installed in the centos On , So what you see tomcat Your image will be larger , It contains the required environment configuration .
In order to pull tomcat Image as an example , You can see docker It seems that the image is downloaded layer by layer .
Why? Docker The mirror should adopt this hierarchical structure
One of the biggest benefits is —— Shared resources
such as : There are multiple images from the same base The image is built , Then the host only needs to save one copy on the disk base Mirror image , At the same time, only one copy needs to be loaded in memory base Mirror image , You can serve all containers . And every layer of the image can be shared .
characteristic
Docker Images are read-only , When the container starts , A new writable layer is loaded on top of the image , This layer is often called the container layer , Below the container layer is called the mirror layer .
Docker Mirror image Commit operation
docker commit Commit the container copy to a new image
docker commit -a=" author " -m=" Description information submitted " Containers ID The target mirror name to create :[ Tag name ]
Case presentation :
- from Hub Upload and download tomcat Mirror to local and run successfully
Errors may occur :
View the running container :
Enter the container :
You can see that there is webapps, Enter this folder to view , It's empty
Back to the next level , You can see there's one webapps.dist, It contains webapps Documents normally required , Move the files inside to webapps Next , Or delete webapps, take webapps.dist Renamed webapps.
Refresh web page , According to the normal :
Background operation : Don't print logs
docker run -d -p 6666:8080 tomcat
-p Host port :docker Container port
-P: Randomly assign ports
i: Interaction
t: terminal
-
Delete the document in the container
-
Current tomcat The running instance is a container without document content , Use it as a template commit A no docs Of tomcat New image mytest/tomcat02
-
Start our new image and compare it with the original
1) Start original tomcat The new container has docs
2) start-up mytest/tomcat02 The new container has no docs
copyright notice
author[Xiao, ry],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201262344468103.html
The sidebar is recommended
- Spring IOC container loading process
- [thinking] the difference between singleton mode and static method - object-oriented programming
- Hadoop environment setup (MySQL environment configuration)
- 10 minutes, using node JS creates a real-time early warning system for bad weather!
- Git tool
- Force deduction algorithm - 92 Reverse linked list II
- What is the sub problem of dynamic programming?
- C / C + +: static keyword summary
- Idea does not have the artifacts option when configuring Tomcat
- Anaconda can't open it
guess what you like
-
I don't know how to start this
-
Matlab simulation of transportation optimization algorithm based on PSO
-
MySQL slow log optimization
-
[Vue] as the window is stretched (larger, smaller, wider and higher), the text will not be displayed
-
Popular Linux distributions for embedded computing
-
Suzhou computer research
-
After installing SSL Certificate in Windows + tomcat, the domain name request is not successful. Please answer!!
-
Implementation time output and greetings of jQuery instance
-
The 72 year old uncle became popular. Wu Jing and Guo fan made his story into a film, which made countless dreamers blush
-
How to save computer research
Random recommended
- Springboot implements excel import and export, which is easy to use, and poi can be thrown away
- The final examination subjects of a class are mathematical programming, and the scores are sorted and output from high to low
- Two pronged approach, Tsinghua Professor Pro code JDK and hotspot source code notes, one-time learning to understand
- C + + recursive knapsack problem
- The use of GIT and GitHub and the latest git tutorial are easy to understand -- Video notes of crazy God speaking
- PostgreSQL statement query
- Ignition database test
- Context didn't understand why he got a high salary?, Nginxfair principle
- Bootstrap switch switch control user's guide, springcloud actual combat video
- A list that contains only strings. What other search methods can be used except sequential search
- [matlab path planning] multi ant colony algorithm grid map path planning [including GUI source code 650]
- [matlab path planning] improved genetic algorithm grid map path planning [including source code phase 525]
- Iinternet network path management system
- Appium settings app is not running after 5000ms
- Reactnative foundation - 07 (background image, status bar, statusbar)
- Reactnative foundation - 04 (custom rpx)
- If you want an embedded database (H2, hsql or Derby), please put it on the classpath
- When using stm32g070 Hal library, if you want to write to flash, you must perform an erase. If you don't let it, you can't write continuously.
- Linux checks where the software is installed and what files are installed
- SQL statement fuzzy query and time interval filtering
- 69. Sqrt (x) (c + + problem solving version with vs runnable source program)
- Fresh students are about to graduate. Do you choose Java development or big data?
- Java project: OA management system (java + SSM + bootstrap + MySQL + JSP)
- Titanic passenger survival prediction
- Vectorization of deep learning formula
- Configuration and use of private image warehouse of microservice architect docker
- Relearn JavaScript events
- For someone, delete return 1 and return 0
- How does Java dynamically obtain what type of data is passed? It is used to judge whether the data is the same, dynamic data type
- How does the database cow optimize SQL?
- [data structure] chain structure of binary tree (pre order traversal) (middle order traversal) (post order traversal) (sequence traversal)
- Webpack packaging optimization solution
- 5. Operation element
- Detailed explanation of red and black trees
- redhat7. 9 install database 19C
- Blue Bridge Cup notes: (the given elements are not repeated) complete arrangement (arrangement cannot be repeated, arrangement can be repeated)
- Detailed explanation of springboot default package scanning mechanism and @ componentscan specified scanning path
- How to solve the run-time exception of test times
- Detailed explanation of k8s management tool kubectl
- Android system view memory command