How to remove an image across all nodes in a Docker swarm?

▼魔方 西西 提交于 2019-12-24 06:21:24

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/46144271/how-to-remove-an-image-across-all-nodes-in-a-docker-swarm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!