Docker Prune

docker Oct 25, 2020

If you find your docker install running out of hard drive space then potentially you have a lot of left over files from previous containers. In the folder /var/lib/docker was using over 50% of my hdd space. Running the below command freed up a substantial amount of space

Run the below command to show used/free space

df -h --total

Next command will show anything in the Docker folder that is using Gigabytes of space. max-depth will search 2 directories deep in the /var/lib/docker directory. grep -E "G" searches for G letter, in this case Gigabytes.

Sudo du -cha --max-depth=2 /var/lib/docker | grep -E "G"

Finally a prune to clear out any stale data.

docker system prune -a -f

Tags

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.