什么是悬空图像和什么是未使用图像? [英] What is a dangling image and what is an unused image?

查看:124
本文介绍了什么是悬空图像和什么是未使用图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在docker Docker镜像修剪的文档中,可以使用-a标志

In the docker documentation of docker image prune it is possible to use the -a flag to


删除所有未使用的图像,而不仅仅是悬空的图像

Remove all unused images, not just dangling ones

及更高版本


删除所有悬空的图像。如果指定了-a,还将删除所有未被容器引用的图像。

Remove all dangling images. If -a is specified, will also remove all images not referenced by any container.

有人可以向我解释什么是悬空图像吗?悬空的图像和未使用的图像有什么区别?

Can someone explain to me what dangling images are and what's the difference between dangling and unused images?

推荐答案

未使用的图像表示未在容器中分配或使用它。例如,当运行 docker ps -a -时,它将列出所有已退出并当前正在运行的容器。显示在任何容器内使用的任何图像均为已用图像。

An unused image means that it has not been assigned or used in a container. For example, when running docker ps -a - it will list all of your exited and currently running containers. Any images shown being used inside any of containers are a "used image".

另一方面,悬空的图像仅表示您已经创建了该图像的新版本,但未指定新名称。因此,您拥有的旧图像成为悬空图像。这些旧映像是未标记的映像,并且在运行 docker映像< none> >。

On the other hand, a dangling image just means that you've created the new build of the image, but it wasn't given a new name. So the old images you have becomes the "dangling image". Those old image are the ones that are untagged and displays "<none>" on its name when you run docker images.

运行 docker system prune -a 时,它将删除未使用和悬空的图像。因此,容器中正在使用的任何图像(无论是已退出还是正在运行的图像)均不会受到影响。

When running docker system prune -a, it will remove both unused and dangling images. Therefore any images being used in a container, whether they have been exited or currently running, will NOT be affected.

这篇关于什么是悬空图像和什么是未使用图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆