Home > Operation and Maintenance > Docker > What does image mean in docker

What does image mean in docker

WBOY
Release: 2021-12-30 11:38:44
Original
7750 people have browsed it

In docker, image means "mirror" and is a file system; image can mount several layers of directories together to form a virtual file system with the same directory structure as Linux. Docker passes these files In addition, the host's kernel provides a Linux virtual environment.

What does image mean in docker

The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.

What does image mean in docker

image Inside is a layer-by-layer file system called Union FS (Union File System).

United file system can mount several layers of directories together to form a virtual file system. The directory structure of the virtual file system is just like the directory structure of ordinary Linux. Docker provides a Linux virtual environment through these files and the kernel of the host.

Each layer of file system is called a layer. The joint file system can set three permissions for each layer of file system, read-only (readonly), read-write (readwrite) and write-out (whiteout-able). ), but each layer of the file system in the docker image is read-only.

When building an image, starting from the most basic operating system, each build operation is equivalent to making a layer of modifications and adding a layer of file system. Layer by layer, modifications to the upper layer will cover the visibility of the lower layer. This is easy to understand, just like the upper layer covers the bottom layer.

When you use it, you will only see a complete whole. You don't know how many layers there are, and you don't know what the modifications made to each layer are. The structure is similar to this:

What does image mean in docker

#From a basic point of view, a typical Linux file system consists of bootfs and rootfs. bootfs (boot file system) mainly includes bootloader and kernel , bootloader is mainly used to boot and load the kernel. When the kernel is loaded into the memory, bootfs will be umounted.

rootfs (root file system) contains standard directories and files such as /dev, /proc, /bin, /etc, etc. in a typical Linux system. The following figure shows the most basic two-layer structure in the docker image. Different Linux distributions (such as ubuntu and CentOS) will have differences in the rootfs layer, reflecting the differences in distribution versions.

What does image mean in docker

When traditional Linux loads bootfs, it will first set rootfs to read-only, and then change rootfs from read-only to read-write after system self-test, and then We can then perform read and write operations on rootfs.

But Docker will not change the read-only of rootfs to read-write after the bootfs self-test is completed. Instead, it will use union mount (a mounting mechanism of UnionFS) to change other layers in the image. Loaded onto the previous read-only rootfs layer, each layer is a rootfs structure and is read-only. Therefore, we cannot modify the layer in an existing image!

Only when we create a container, that is, instantiate the Docker image, the system will allocate an empty read-write rootfs to save the modifications we make. The changes saved by a layer are incremental, just like git.

What does image mean in docker

#To sum up, image is actually a file system, which together with the host's kernel provides a virtual Linux environment for the program. When starting a docker container, docker will build a virtual Linux environment for the container based on the image.

Recommended learning: "docker video tutorial"

The above is the detailed content of What does image mean in docker. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template