Dokku’s /var/lib/docker/overlay2 too big?

Dokku’s /var/lib/docker/overlay2 too big?

One of the frustrating things about Dokku, is that pushes often report as succesful when they haven’t been. The most obvious example is when it didn’t trigger a build (see last post for more on that). But another one is if you’re out of disk space, and dokku fills up the /var/lib/overlay2 directory with a lot of images. Dokku’s own prune command is very conservative and doesn’t make much of an impact at all. And deleting anything from this directory is an absolute no no.

Freeing up space more effectively can be done with

docker system prune -a
Enter fullscreen mode
Exit fullscreen mode

This freed me up 21G of space. But it is going to fill up again pretty soon, so this is best set up as a cron job with the -f flag to stop it requesting for confirmation

Hit crontab -e and add the following

56 10 * * * docker system prune -af
Enter fullscreen mode
Exit fullscreen mode

And this should keep your /var/lib/docker/overlay2 folder in check


Discover more from Coursity

Subscribe to get the latest posts to your email.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *