Created
November 22, 2018 12:25
-
-
Save sirkonst/413475ee055a588c58661363c461122e to your computer and use it in GitHub Desktop.
Remove unused docker resources with systemd (service and timer)
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=Remove unused docker resources | |
Documentation=https://docs.docker.com/v17.09/engine/admin/pruning/ | |
After=docker.service | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/bin/docker system prune -f --filter "until=744h" | |
ExecStart=/usr/bin/docker volume prune -f | |
TimeoutSec=10m | |
[Install] | |
WantedBy=multi-user.target |
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=Run docker-prune daily | |
[Timer] | |
OnCalendar=daily | |
Persistent=true | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should you not want to start
docker-prune.timer
right after configuration but rather at the configured time, runsystemctl restart timers.target
instead. (https://unix.stackexchange.com/questions/563896/systemd-timer-will-not-fire/563897#563897)