Skip to main content

Watchtower

Trust me. You need some Watchtower in your life. 

This little app will watch your containers, and when a new container image comes up on Docker Hub, Watchtower will bounce your app and update the containers automatically. Zero maintenance required on your part. 

Here's a docker-compose: 

services:
  watchtower:
   environment:
     TZ: Australia/Sydney
     WATCHTOWER_NOTIFICATIONS: shoutrrr
     WATCHTOWER_NOTIFICATION_TEMPLATE: "{{range .}}{{.Time.Format \"12-01-2020 15:04:05\"}} ({{.Level}})':' {{.Message}}{{println}}{{end}}"
     WATCHTOWER_NOTIFICATION_URL: "discord-webhook-here"
"
     WATCHTOWER_SCHEDULE: "0 0 4 * * *"
     WATCHTOWER_HTTP_API_TOKEN: apitoken1
     WATCHTOWER_HTTP_API_METRICS: "true"
   command: --http-api-update --cleanup
   image: "containrrr/watchtower"
   ports:
    - 1080:8080
   volumes:
    - /var/run/docker.sock:/var/run/docker.sock
   restart: always


There's a section in this compose for posting Watchtower messages to Discord. Details on how to configure this are here

The WATCHTOWER_SCHEDULE is based on simple Cron syntax, so you can configured it how you like. My example runs at 4am every morning.