如何在Docker群中的所有节点上删除映像? [英] How to remove an image across all nodes in a Docker swarm?

查看:153
本文介绍了如何在Docker群中的所有节点上删除映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在本地主机上,我可以使用 docker image rm docker rmi 删除映像。



如果我当前的主机是Docker群中的管理器节点,而我希望在整个集群中级联此操作怎么办?



当我第一次创建Docker服务时,该镜像在群集中的每个节点上均被下拉。删除该服务不会删除该图像,并且所有节点都保留该图像的副本。



很自然,如果有一种方法可以将图像推给所有人那么节点也应该有同样自然的方法来删除它们,而不必通过SSH进入每台机器:'(另外,这是一个真正的问题。节点早晚必然会没有更多的磁盘空间!

解决方案

AFAIK到目前为止,还没有这样的选项。每个节点负责其自身的清理操作。命令 docker system prune -f 可用于清除容器数据。



但是可以使用删除已标记的图像仅限docker rmi 。请参见以下问题



https://github.com/moby/moby/issues/24079


On the local host, I can remove an image using either docker image rm or docker rmi.

What if my current host is a manager node in a Docker swarm and I wish to cascade this operation throughout the swarm?

When I first created the Docker service, the image was pulled down on each node in the swarm. Removing the service did not remove the image and all nodes retain a copy of the image.

It feels natural that if there's a way to "push" an image out to all the nodes then there should be an equally natural way to remove them too without having to SSH into every single machine :'( Plus, this is a real problem. Sooner or later the nodes are bound to have no more disk space!

解决方案

AFAIK there is no such option as of now. Each node is responsible of its own cleanup. There is a command docker system prune -f that you can use to clear container data.

But tagged images can be deleted using docker rmi only. See below issues

https://github.com/moby/moby/issues/24079

这篇关于如何在Docker群中的所有节点上删除映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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