Cleaning up after docker.09 Feb 2021
I was working on my personal computer and got a low disk space warning while playing around with some Docker images. So I went back to this blog post, Keeping the whale happy, which is generally good.
I wanted to just clean out everything. Some notes: the commands in this tutorial, if there are two
docker commands, and you call
sudo, you need
sudo in front of all of them.
I used the blank slate option, “delete stopped containers, and volumes and networks that are not used by containers”:
sudo docker system prune -a
I was able to get back 50GB of disk space! So I also added this script to my crontab to clean things up on a regular basis:
#!/bin/bash docker rmi $(docker images -q -f dangling=true) docker volume rm $(docker volume ls -qf dangling=true)
(Instructions in the post.)