markdown 如何删除未使用的Docker容器和图像

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 如何删除未使用的Docker容器和图像相关的知识,希望对你有一定的参考价值。

1. Delete all containers

        $ docker ps -q -a | xargs docker rm

-q prints only the container IDs
-a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

2. Delete all untagged images

        $ docker rmi $(docker images | grep “^<none>” | awk ‘{print $3}’)

awk must use a single quote (this filters all image IDs)

以上是关于markdown 如何删除未使用的Docker容器和图像的主要内容,如果未能解决你的问题,请参考以下文章