简体   繁体   English

修剪 docker 网络,容器不删除镜像

[英]prune docker network, container without deleting image

Hi I just wanted to ask That is it possible to delete docker network, container but not delete the docker image while pruning.嗨,我只是想问一下,修剪时是否可以删除 docker 网络、容器但不能删除 docker 图像。

We have some condition where we would like to create network again, but deleting the images is bit difficult, as we can't download/pull so many docker images once again.我们有一些条件想再次创建网络,但删除图像有点困难,因为我们无法再次下载/提取这么多 docker 图像。

If you just want to delete one Network you can simply do如果你只想删除一个网络,你可以简单地做

docker network rm <networkname>

If you want to delete all networks which are currently unused you can use如果要删除当前未使用的所有网络,可以使用

docker network prune

This Just removes unused Networks - so networks which don't reference to a running Container.这只是删除未使用的网络 - 因此网络不引用正在运行的容器。 ( https://docs.docker.com/engine/reference/commandline/network_prune/ ). https://docs.docker.com/engine/reference/commandline/network_prune/ )。 Both Solutions do not affect your images.两种解决方案都不会影响您的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM