01What Watchtower Does
Watchtower monitors your running containers and automatically updates them when new images are available. It:
• Checks registries for new image versions
• Pulls updated images
• Restarts containers with the same configuration
• Optionally notifies you of updates
**When it's great:**
• Home labs with many containers
• Non-critical services
• Keeping security patches current
**When to avoid it:**
• Production workloads needing stability
• Apps requiring tested upgrade paths
• Databases and stateful services
Automatic updates can break things. Always have backups and test critical services manually before enabling Watchtower.
02Basic Watchtower Setup
Run Watchtower as a container that monitors other containers. It needs access to the Docker socket to manage containers.
1services: 2 watchtower: 3 image: containrrr/watchtower:latest4 container_name: watchtower5 environment: 6 - TZ=Europe/London7 - WATCHTOWER_CLEANUP=true # Remove old images8 - WATCHTOWER_INCLUDE_STOPPED=false # Only update running containers9 - WATCHTOWER_POLL_INTERVAL=86400 # Check every 24 hours (seconds)10 volumes: 11 - /var/run/docker.sock:/var/run/docker.sock12 restart: unless-stoppedWATCHTOWER_CLEANUP removes old images after updating. This saves disk space but means you can't quickly roll back.
03Scheduling Updates
Control when Watchtower checks for and applies updates. Use cron expressions for precise scheduling.
1services: 2 watchtower: 3 image: containrrr/watchtower:latest4 environment: 5 - TZ=Europe/London6 # Cron schedule (6 fields: second minute hour day month weekday)7 - WATCHTOWER_SCHEDULE=0 0 4 * * * # Every day at 4 AM8 # Or use poll interval (simpler)9 # - WATCHTOWER_POLL_INTERVAL=86400 # Every 24 hours10 volumes: 11 - /var/run/docker.sock:/var/run/docker.sock1213# Common schedules:14# 0 0 4 * * * - Daily at 4 AM15# 0 0 4 * * 0 - Weekly on Sunday at 4 AM16# 0 0 4 1 * * - Monthly on 1st at 4 AM17# 0 0 */6 * * * - Every 6 hours04Update Notifications
Get notified when Watchtower updates containers. Supports many notification services.
1services: 2 watchtower: 3 image: containrrr/watchtower:latest4 environment: 5 - TZ=Europe/London6 - WATCHTOWER_SCHEDULE=0 0 4 * * *7 - WATCHTOWER_CLEANUP=true8 # Email notifications9 - WATCHTOWER_NOTIFICATIONS=email10 - WATCHTOWER_NOTIFICATION_EMAIL_FROM=watchtower@example.com11 - WATCHTOWER_NOTIFICATION_EMAIL_TO=you@example.com12 - WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.example.com13 - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=58714 - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=smtp-user15 - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=${SMTP_PASSWORD}16 volumes: 17 - /var/run/docker.sock:/var/run/docker.sock1819# Other notification options:20# - WATCHTOWER_NOTIFICATIONS=slack21# - WATCHTOWER_NOTIFICATIONS=gotify22# - WATCHTOWER_NOTIFICATIONS=shoutrrr (supports many services)05Selective Container Updates
Control which containers Watchtower updates using labels. This lets you auto-update some while protecting others.
1services: 2 watchtower: 3 image: containrrr/watchtower:latest4 environment: 5 - WATCHTOWER_LABEL_ENABLE=true # Only update labeled containers6 volumes: 7 - /var/run/docker.sock:/var/run/docker.sock89 # This container WILL be auto-updated10 plex: 11 image: linuxserver/plex:latest12 labels: 13 - "com.centurylinklabs.watchtower.enable=true"1415 # This container will NOT be updated (no label)16 database: 17 image: postgres:161819 # Explicitly disable updates20 critical-app: 21 image: myapp:latest22 labels: 23 - "com.centurylinklabs.watchtower.enable=false"Use WATCHTOWER_LABEL_ENABLE=true for opt-in updating. This is safer than updating everything by default.
06Monitor-Only Mode
Run Watchtower in monitor-only mode to get notifications about available updates without automatically applying them.
1services: 2 watchtower: 3 image: containrrr/watchtower:latest4 environment: 5 - WATCHTOWER_MONITOR_ONLY=true # Don't update, just notify6 - WATCHTOWER_NOTIFICATIONS=shoutrrr7 - WATCHTOWER_NOTIFICATION_URL=discord://token@webhookid8 - WATCHTOWER_SCHEDULE=0 0 8 * * * # Check at 8 AM9 volumes: 10 - /var/run/docker.sock:/var/run/docker.sock1112# Monitor mode is great for:13# - Seeing what updates are available14# - Planning maintenance windows15# - Verifying images before updating07Alternatives to Watchtower
Watchtower isn't the only option. Consider these alternatives based on your needs:
**Diun (Docker Image Update Notifier)**
• Notification only, no auto-update
• More notification options
• Supports image registries directly
**Ouroboros**
• Similar to Watchtower
• Different feature set
**Manual updates**
• docker compose pull && docker compose up -d
• Most control, least automation
1# Diun - notification only2services: 3 diun: 4 image: crazymax/diun:latest5 container_name: diun6 environment: 7 - TZ=Europe/London8 - DIUN_WATCH_SCHEDULE=0 8 * * *9 - DIUN_PROVIDERS_DOCKER=true10 - DIUN_NOTIF_DISCORD_WEBHOOKURL=${DISCORD_WEBHOOK}11 volumes: 12 - ./diun:/data13 - /var/run/docker.sock:/var/run/docker.sock:ro1415# Manual update script16# #!/bin/bash17# cd /path/to/compose18# docker compose pull19# docker compose up -d --remove-orphans20# docker image prune -fFor production, consider Diun for notifications + manual updates. It gives you visibility without risking automatic changes.