Dokcer prune

prune 命令用来删除不再使用的 docker 对象。

删除所有未被 tag 标记和未被容器使用的镜像:

[root@zhangpeng ~]# docker volume prune
WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
[root@zhangpeng ~]# 

删除所有未被容器使用的镜像:

docker image prune -a

删除所有停止运行的容器:

docker container prune

删除所有未被挂载的卷

 docker volume prune

删除所有网络:

docker network prune

删除 docker 所有资源:

docker system prune
[root@zhangpeng usr]# docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          5         2         654.1MB   586MB (89%)
Containers      3         1         686.9MB   542.8MB (79%)
Local Volumes   0         0         0B        0B
Build Cache     0         0         0B        0B
[root@zhangpeng usr]#

参考链接:

参考链接: