In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "what is the commit operation of Docker image". Xiaobian shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "what is the commit operation of Docker image" can help you solve the problem.
Docker image is UnionFS (Federated File System)
UnionFS: The Union file system is a hierarchical, lightweight, and high-performance file system that supports changes to the file system as a single commit layer upon layer, while uniting several directories into a single virtual file system. The Union file system is the basis for Docker images. Mirrors can be inherited through layering, and various specific application mirrors can be made based on the base mirror (no parent mirror).
Features: Multiple file systems are loaded at once, but only one file system is visible from the outside. Joint loading overlays the file systems so that the final file system contains all the underlying files and directories.
Docker image loading principle
Docker's image is actually composed of layers of file systems, such as UnionFS.
bootfs (boot file system) mainly contains bootloader and kernel, bootloader mainly loads kernel, Linux will load bootfs file system when it is just started, and botfs is the bottom layer of Docker image. This layer is the same as our typical Linux/Unix system, containing the boot loader and kernel. After boot loading is complete, the entire kernel is in memory, and the use of memory has been transferred from bootfs to the kernel. At this time, the system will also uninstall bootfs.
rootfs (root file system), above bootfs, contains standard directories and files such as/dev,/proc,/bin,/etc in typical Linux systems. rootfs is a variety of different operating system distributions, such as Ubuntu, Centos, etc.
For a streamlined OS, rootfs can be very small and only need to include the most basic commands, tools and libraries, so the bottom layer directly uses the Host kernel and only needs to provide rootfs. Thus, bootfs is basically the same for different Linux distributions, rootfs will be different, so different distributions can share bootfs.
Layered Mirrors
Let's take tomcat image as an example. In the download layer, you can see that docker image seems to be downloaded layer by layer.
Why Docker images should have this hierarchical structure
And the best part about it--sharing resources.
For example, if multiple images are built from the same base image, the host only needs to save one base image on disk and load one base image in memory to serve all Kubernetes Engine containers. And each layer of mirroring can be shared.
characteristics
Docker images are all read-only, and when the container starts, a new writable layer is loaded on top of the image. This layer is often referred to as the "container layer," and everything below the "container layer" is called the "mirror layer."
Docker commit What can docker commit do?
docker commit
Commit the container copy to make it a new mirror docker
commit format
docker commit -m='description of submission' -a='author' container ID new image name: label case demo
Download a tomcat image locally and run successfully
[root@docker ~]# docker pull tomcat[root@docker ~]# docker run -d -p 8888:8080 tomcat
Enter the container and create the file test under/directory, exit the container
[root@docker ~]# docker exec -it $(docker ps -q) bashroot@4004f1503c75:/usr/local/tomcat# touch /testroot@4004f1503c75:/usr/local/tomcat# exit
The tomcat container that is currently running creates a new test file in the root directory, and commits a tomcat image with a test file in the root directory as a template.
#New image created successfully [root@docker ~]# docker commit -a="test" -m="test" $(docker ps -q) tomcat:test sha256:1dcb7604643bb29e47420f7a4d40582564a89df59fd3ae4602e72a84f27af9db [root@docker ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE tomcat test 1dcb7604643b About a minute ago 649 MB tocmat latest 625b734f984e 41 hours ago 648 MB
Start the new image tomcat:test and check if there is a test file in the/directory
[root@docker ~]# docker run -d tomcat:test[root@docker ~]# docker exec -it ec738896bc67 ls /test/test That's all for "What is the commit operation of Docker images?" Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the industry information channel. Xiaobian will update different knowledge points for you every day.
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.