diff options
author | Daniel Hansson <github@hanssonit.se> | 2019-01-05 03:51:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-05 03:51:53 +0300 |
commit | 65db319c4797ed166d586009a5f8b3008cf324ec (patch) | |
tree | 71466ab684426e30d7411e85ffb6f156f8128025 /nextcloud_update.sh | |
parent | 4ad686eae6e9ba30061b51a27166edbfdb6e4f6e (diff) |
update all docker images with watchtower
https://github.com/v2tec/watchtower
Diffstat (limited to 'nextcloud_update.sh')
-rw-r--r-- | nextcloud_update.sh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/nextcloud_update.sh b/nextcloud_update.sh index a5786233..681fee6e 100644 --- a/nextcloud_update.sh +++ b/nextcloud_update.sh @@ -102,11 +102,14 @@ then ln -s "$ADMINERDIR"/latest.php "$ADMINERDIR"/adminer.php fi -# Update docker images -# This updates ALL Docker images: +# Update ALL Docker images automatically with watchtower: if [ "$(docker ps -a >/dev/null 2>&1 && echo yes || echo no)" == "yes" ] then - docker images --format "{{.Repository}}:{{.Tag}}" | grep :latest | xargs -L1 docker pull + cont_name=watchtower + if ! docker ps -a --format '{{.Names}}' | grep -Eq "^${cont_name}\$"; + then + docker run -d --name watchtower -v /var/run/docker.sock:/var/run/docker.sock v2tec/watchtower --cleanup --interval 3600 + fi fi # Cleanup un-used packages |