docker 操作命令汇集

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wxb880114/article/details/81592090

清除方法

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

欢迎大家一起加入讨论!!!

猜你喜欢

转载自blog.csdn.net/wxb880114/article/details/81592090