docker prune之filter

607 阅读1分钟

背景

很多时候,我们做镜像容器等清理的时候,可能需要清理某一类的,而不是一个个操作

准备

dockerfile 中添加label,如

label tag=hello

清理

docker image prune --filter="tag=hello"

docker container prune同理

当然可以直接用docker system prune --filter="tag=hello"