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

Introduction to Docker and Docker Image Management in practical Application

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

Share

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

What is the mirror image?

A tiered file, a software environment, an image can create N containers, a standardized delivery, a compact Linux operating system image that does not contain a Linux kernel is not a single file, but has 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. Docker images are stored in / var/lib/docker/\ by default.

two。 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. Address: https://hub.docker.com/explore configuration Image Accelerator: https://www.daocloud.io/mirrorcurl-sSL https://get.daocloud.io/daotools/set_mirror.sh | sh-s http://f1361db2.m.daocloud.io

3. Contact the image with the container

As shown in the figure, the container actually adds a read-write layer on the top of the image. When running changes to the files in the container, the files to be written in the image will be copied to the container's own file system (read-write layer). If the container is deleted, the top read and write layer is deleted and the changes are lost. Therefore, no matter how many containers share an image, the write operations are copied from the mirrored file system, and the mirrored source files are not modified, which improves disk utilization. If you want to persist these changes, you can save the container as a new image through docker commit.

4. Common commands for managing mirrors

5. Actual combat exercise

Launch Container: docker run-d-- name=nginxserver-p 80:80 nginx browser visit: http://ip View Container Construction process: docker image history nginx View Image list: docker images View Image Construction details: docker images inspect nginx View currently running Container: docker ps docker container ls Save Image: docker save nginx > nginx.tar Import Image: docker load < nginx.tar

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