Created
March 24, 2024 17:58
-
-
Save aadityabhatia/791837c1d756581cb4af0f2ef2089fa6 to your computer and use it in GitHub Desktop.
systemd service and timer to prune outdated Docker images and limit disk usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Docker Image Prune | |
After=docker.socket | |
Requires=docker.socket | |
[Service] | |
Type=oneshot | |
ExecStart=docker image prune --all --force --filter "until=24h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Prune outdated Docker images weekly to limit disk usage | |
[Timer] | |
OnBootSec=1h | |
OnUnitActiveSec=1w | |
RandomizedDelaySec=1h | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment