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

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

问题描述

在 docker docker image prune 文档 中可以使用

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 镜像 时,那些旧镜像是未标记并在其名称上显示"的镜像.

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天全站免登陆