Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Connection between docker image and container, storage driver

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

2.1 connection between docker image and container, storage driver

What is a mirror image? To put it simply, the docker image is a compact Linux operating system that does not contain a Linux kernel.

Where does the image come from? Docker hub is a public registry maintained by docker, which contains a large number of container images. The docker tool downloads images from this public image library by default:

Https://hub.docker.com/explore

The default is a foreign source, and the download will be slow. It is recommended to configure a domestic image repository:

[root@localhost ~] # vim / etc/docker/daemon.json

{

"registry-mirrors": ["https://registry.docker-cn.com"]"

}

Restart docker after configuration: [root@localhost ~] # systemctl restart docker

After rebooting, we can download a docker image and try it:

[root@localhost ~] # docker pull nginx

We have finished downloading the nginx image using the docker pull command. Next, let's use docker images to view the images we have downloaded:

[root@localhost ~] # docker images

If we need to download a nginx1.12 version of the image, then we can execute the following command to do so:

[root@localhost ~] # docker pull nginx:1.12

Next, we verify that the image of the nginx1.12 version has been downloaded:

[root@localhost ~] # docker images

Connection between the image and the container:

An image is not a single file, but is made up of multiple layers. We can view the content and size of each layer in the image through docker history, and each layer corresponds to an instruction in dockerfile. The Docker image of Centos is stored in / var/lib/docker/overlay2 by default.

[root@localhost overlay2] # docker history nginx

The container actually adds a read-write layer on top of the image, and any file changes made in the running container will be written to this read-write layer. If the container is deleted, the top read and write layer is deleted and the changes are lost. Docker uses storage drivers to manage mirroring each layer of content and the readable container layer.

Storage driver:

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report