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

Why is the size of the Docker image inconsistent with that in the repository?

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Before we begin

If you look closely, you will find that the disk space occupied by an image in the Docker host is different from the size of the image seen on the Docker Hub (repository). For example, golang:1.9 displays 272MB in the Docker Hub (repository), while the docker image ls command gives 733MB after the image is downloaded.

This is because the size displayed in the Docker Hub (repository) is the compressed volume, and the image remains compressed during the process of downloading and uploading the image to ensure that the image can be downloaded or uploaded more quickly, while the docker image ls command is the sum of the space occupied by each layer after the image is downloaded locally.

Unino FS

Docker mirrors are multi-tier storage structures and can be inherited and reused, so different mirrors may share a common layer because they use the same underlying image. The sum of the image volumes listed in the docker image ls command is not all images actually consume hard disk space, because based on Union FS technology (federated file system), only one copy of the same layer needs to be saved, so the actual mirror disk space may be much smaller than this.

You can view the space occupied by mirrors, containers, and data volumes with the following command.

Docker system dfTYPE TOTAL ACTIVE SIZE RECLAIMABLEImages 520 9.846GB 9.846GB (100%) Containers 000B 0BLocal Volumes 0 The 0 0B 0B command helps docker system--helpUsage: docker system COMMANDManage DockerOptions:-- help Print usageCommands: `df` Show docker disk usage events Get real time events from the server info Display system-wide information prune Remove unused data# omit.

Note that the system subcommand is supported in docker 1.13.1 (inclusive).

Summary

Finally, let's summarize the knowledge points in the article.

The Docker repository focuses on the network, and the image is always compressed during download and upload. Due to the characteristics of Union FS, different docker images may use the same basic image. The total image volume listed in the doker images command does not represent the actual disk space used and needs to be replaced by the docker system df command.

Reference article

Doker&k8s Qun [703906133]

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