Created
June 8, 2022 06:31
-
-
Save jeremysherriff/2b28b30142b6155b48cb51095366c75a to your computer and use it in GitHub Desktop.
Automated updating of containers via cron
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
#!/bin/sh | |
# Automated updating of containers via cron | |
# Leverages watchtower for auto image cleanup and robustness. | |
if [ -t 1 ] ; then | |
echo "Running in an interactive shell" | |
else | |
exec 1>/dev/null | |
exec 2>/dev/null | |
fi | |
docker pull containrrr/watchtower | |
docker run --rm --name watchtower-runonce \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
containrrr/watchtower \ | |
--stop-timeout 30s \ | |
--cleanup \ | |
--rolling-restart \ | |
--include-stopped \ | |
--run-once \ | |
$* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment