Skip to main content

Watchtower (Auto-Update Docker Containers)

·212 words·1 min

What Watchtower Does
#

Watchtower automatically pulls newer images for your running containers and restarts them with the updated image.
In plain terms: it keeps your stack (Sonarr, Radarr, qBittorrent, etc.) up to date without you manually docker pull + docker compose up -d every time.

This is especially nice in a homelab where:

  • You don’t want to babysit containers.
  • You still want security/bugfix updates applied.
  • You don’t mind a brief restart when something updates.

You can run Watchtower in “just tell me” mode or “actually update things” mode. Below is the auto-update version.


Environment Variables / Secrets You May Want
#

  1. WATCHTOWER_NOTIFICATIONS

    • Example: email, shoutrrr, etc.
    • If you don’t care about notifications, you can leave this out.
  2. WATCHTOWER_CLEANUP=true

    • After updating, prune old images so you don’t fill the disk.
  3. WATCHTOWER_SCHEDULE

    • Cron-style string so it doesn’t constantly hammer Docker Hub.
    • Example below runs daily at 4am.

These go in environment:.


Docker Compose Service for Watchtower
#

version: '3.8'
services:
  watchtower:
    image: containrrr/watchtower:latest
    container_name: watchtower2
    restart: always
    environment:
      WATCHTOWER_SCHEDULE: "0 0 0 * * *" 
      TZ: America/Chicago
      WATCHTOWER_RUN_ONCE: 'false'
      WATCHTOWER_MONITOR_ONLY: 'false'
      WATCHTOWER_CLEANUP: 'true'
      WATCHTOWER_NOTIFICATIONS: email
      WATCHTOWER_NOTIFICATION_EMAIL_FROM: noreply@corr.cloud
      WATCHTOWER_NOTIFICATION_EMAIL_TO: kolton@corr.cloud
      # you have to use a network alias here, if you use your own certificate
      WATCHTOWER_NOTIFICATION_EMAIL_SERVER: mail.corr.cloud
      WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT: 25
      WATCHTOWER_NOTIFICATION_EMAIL_DELAY: 2
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
Kolton Corr
Author
Kolton Corr
A little bit about you