# docker system prune --all --volumes WARNING! This will remove: - all stopped containers - all networks not used by at least one container - all volumes not used by at least one container - all images without at least one container associated to them - all build cache
删除整个/var/lib/docker【适用于构建机器】
有的时候即使使用docker system prune --all --volumes -f删除无用数据,overlay2下磁盘依旧删不了多少东西。这时候通常会发现是du -ah --max-depth=1 /var/lib/docker/overlay2/**/diff下的空间占据太大,那么针对**仅用于构建场景的机器**,可以考虑删除整个docker文件夹【而不是删除overlay2下的文件夹,否则可能会出现启动问题】
停止服务
1 2
system status docker systemctl stop docker.socket
删除
1
rm -rf /var/lib/docker
重新启动
1
systemctl start docker
验证
1 2 3
systemctl status docker systemctl status docker -l systemctl status docker.socket -l