Created
November 10, 2024 23:15
-
-
Save gintsmurans/dfe0d15f8efe1588d5c54817229c099f to your computer and use it in GitHub Desktop.
Docker prune service
This file contains hidden or 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
# /etc/systemd/system/docker-prune.service | |
[Unit] | |
Description=Daily Prune of Docker Images and Containers | |
Documentation=https://docs.docker.com/config/pruning/ | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/bin/docker system prune -f | |
ExecStartPost=/usr/bin/echo "Docker environment now as clean as a whistle, or at least cleaner than yesterday." | |
[Install] | |
WantedBy=multi-user.target |
This file contains hidden or 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
# /etc/systemd/system/docker-prune.timer | |
# | |
# After saving run these to enable the timer: | |
# systemctl enable docker-prune.timer | |
# systemctl start docker-prune.timer | |
[Unit] | |
Description=Run Docker Prune at 3AM Daily | |
[Timer] | |
OnCalendar=*-*-* 03:00:00 | |
Persistent=true | |
Unit=docker-prune.service | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment