- Copy service and timer to
/etc/systemd/system/
sudo systemctl daemon-reload
sudo start docker-trimmer.timer
sudo enable docker-trimmer.timer
Created
September 21, 2020 15:10
-
-
Save pohmelie/272b5c2487df60eb7ef1c9db4936b331 to your computer and use it in GitHub Desktop.
Trim docker images for 1 week every sunday 00:00
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 containers and "old" images (older, than week) | |
[Service] | |
ExecStart=/bin/bash -c "docker container prune -f && docker image prune -a -f --filter until=168h" |
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-trimmer every weekend | |
[Timer] | |
OnCalendar=Sun | |
Unit=docker-trimmer.service | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment