Prune Docker Images Daily

I am looking at keeping old images cleaned up from a VM that I have access to. I'm looking at keeping storage space minimal is because there is low hard disk space. Let's do this from a daily crontab.

Create a file in /etc/crontab.daily

nano /etc/crontab.daily/docker-prune

In the contents of the file we will insert the following.

#!/bin/bash
podman system prune -af  --filter "until=$((30*24))h"

Allow the file to be executed.

chmod +x /etc/crontab.daily/docker-prune

NOTE: I use Podman instead of Docker but the command above is interchangeable in this instance.

Quick About

Hi, I am Michael Harrison. Devops/Developer for day job and father full time. I like machines such as 3d printers and like designing items for them.

Contact


E-mail: [email protected]
Phone: (765) 421-6199

Other Information


[Construction Icon]