Skip to content

Commit

Permalink
watchtower: add mechanism to update lastes images vrsion of running c…
Browse files Browse the repository at this point in the history
…ontainers
  • Loading branch information
tomMoulard committed Mar 20, 2022
1 parent 8380f56 commit 94f369a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .env.default
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ VPN_IMAGE_VERSION=
VPN_IPSEC_PSK=
VPN_PASSWORD=
VPN_USER=
WATCHTOWER_CLEANUP=
WATCHTOWER_IMAGE_VERSION=
WATCHTOWER_ROLLING_RESTART=
WATCHTOWER_SCHEDULE=
11 changes: 11 additions & 0 deletions test_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,17 @@ services:
restart: always
volumes:
- /lib/modules:/lib/modules:ro
watchtower:
environment:
WATCHTOWER_CLEANUP: "true"
WATCHTOWER_ROLLING_RESTART: "true"
WATCHTOWER_SCHEDULE: '''0 0 2 * * *'''
image: containrrr/watchtower:latest
labels:
traefik.enable: "False"
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
wordpress:
depends_on:
wordpress-db:
Expand Down
11 changes: 11 additions & 0 deletions watchtower/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Watchtower

https://containrrr.dev/watchtower/

A container-based solution for automating Docker container base image updates.

With watchtower you can update the running version of your containerized app
simply by pushing a new image to the Docker Hub or your own image registry.
Watchtower will pull down your new image, gracefully shut down your existing
container and restart it with the same options that were used when it was
deployed initially.
14 changes: 14 additions & 0 deletions watchtower/docker-compose.watchtower.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '2'

services:
watchtower:
image: containrrr/watchtower:${WATCHTOWER_IMAGE_VERSION:-latest}
environment:
WATCHTOWER_CLEANUP: ${WATCHTOWER_CLEANUP:-true}
WATCHTOWER_ROLLING_RESTART: ${WATCHTOWER_ROLLING_RESTART:-true}
WATCHTOWER_SCHEDULE: ${WATCHTOWER_SCHEDULE:-'0 0 2 * * *'} # run at 2am everyday
restart: always
labels:
traefik.enable: false
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'

0 comments on commit 94f369a

Please # to comment.