Skip to content

Instantly share code, notes, and snippets.

@shsteven
Created December 12, 2019 00:48
Show Gist options
  • Save shsteven/8ec540fe710748a53913a48b6ff9538a to your computer and use it in GitHub Desktop.
Save shsteven/8ec540fe710748a53913a48b6ff9538a to your computer and use it in GitHub Desktop.
Cron job to purge docker images every day at 1am, if disk usage is over 80%
0 1 * * * df -Ph / | grep root | awk '{ if($5 > 80) print $0;}' | docker image prune -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment