清除方法

sudo docker system prune -a

删除docker 的image、container、volume

参考:
https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes

I have found a work-around in the meantime. It’s a little tedious, but it clears up space on my Ubuntu 16.04 VM. Essentially… performing a “double-tap” on the system. Running as root or any system sudoer:

docker rm $(docker ps -a -q)
docker rmi --force $(docker images -q)
docker system prune --force

# Double-tap
systemctl stop docker
rm -rf /var/lib/docker/aufs
apt-get autoclean
apt-get autoremove
systemctl start docker

Make sure you’re not cd’d into your /var/lib/docker/aufs directory when running these commands.
It did work for me running inside /var/lib/docker/.
Just for sanity’s sake, check your docker service with sudo systemctl docker status
verify the /var/lib/docker/aufs directory is empty with ls /var/lib/docker/aufs/.
If nothing returns, it has been emptied!
Lastly, check your system’s storage space with df. Happy times!

参考:https://github.com/moby/moby/issues/21925

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐