Lewati ke isi

disk penuh gara gara docker

command untuk membersihkan semua kontainer docker untuk menghemat disk

From our side we used:

sudo docker system prune -a -f

Which saved me 3Go!

We also used the famous commands:

sudo docker rm -v $(sudo docker ps -a -q -f status=exited)
sudo docker rmi -f  $(sudo docker images -f "dangling=true" -q)
docker volume ls -qf dangling=true | xargs -r docker volume rm

We put that on cron to manage a little bit more efficently our disk space.

Reference: https://forums.docker.com/t/some-way-to-clean-up-identify-contents-of-var-lib-docker-overlay/30604/4

Life saver! I had no idea why df said my ec2 volume was full until I ran ncdu on my /var directory which led me here! I reclaimed 280+ GB from that first command! – Josh Yolles Sep 22, 2020 at 18:22 3 Careful with that 3rd command (... xargs -r docker volume rm). Make sure the containers that may use those volumes are running when you run this. Otherwise, they will be seen as dangling, and therefore deleted. – Julien Oct 7, 2020 at 23:29 1 There is a lot of discussion on this: github.com/moby/moby/issues/33775 A lot of people have run into the overlay directory consuming more space than expected and that it isn't clear how to clean it up. – Mnebuerquo Apr 22, 2022 at 20:33