越往下的,越要慎重
列出无用的卷
docker volume ls -qf dangling=true
清理无用的卷,容器,镜像
docker volume rm $(docker volume ls -qf dangling=true)
docker rmi $(docker images | grep '^<none>' | awk '{print $3}')
docker images --no-trunc | grep '<none>' | awk '{ print $3 }'
| xargs docker rmi
docker system prune
docker volume prune
docker rm $(docker ps -q)
docker rmi $(docker images -q)
执行以下命令会彻底清除所有容器。
docker system prune -a -f
或者:
docker rm -f $(docker ps -qa)
rm -rf /var/lib/etcd /var/lib/cni /var/run/calico
rm -rf /etc/kubernetes/ssl /etc/kubernetes/.tmp/
rm -rf /opt/cni
或者:
docker rm -f `docker ps -aq && rm -rf /var/lib/etcd /var/lib/cni /var/run/calico /etc/kubernetes/ssl /etc/kubernetes/.tmp/ /opt/cni`