Why Watchtower?

Docker images get security patches, bug fixes, and new features. Without Watchtower, updates are manual:

  • Automatic pulls — Detects new images and pulls them.
  • Recreates containers — Same config, new image, zero downtime.
  • Schedule control — Cron-based timing (e.g., nightly, weekly).
  • Per-container policies — Exclude, monitor-only, or auto-update.
  • Notifications — Slack, Discord, Telegram, email, Gotify.
  • Cleanup — Removes old images after update.

Prerequisites

  • Docker on any machine.
  • Access to Docker socket.

Deploy Watchtower

docker run -d \
  --name watchtower \
  --restart=always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e WATCHTOWER_SCHEDULE="0 0 4 * * *" \
  -e WATCHTOWER_CLEANUP=true \
  -e WATCHTOWER_INCLUDE_STOPPED=true \
  containrrr/watchtower

This checks for updates daily at 4 AM.


Update Policies

PolicyLabel / FlagBehavior
Auto-update (default)Pull + recreate automatically
Monitor onlyWATCHTOWER_MONITOR_ONLY=trueNotify but don’t update
Exclude containercom.centurylinklabs.watchtower.enable=falseSkip this container entirely
Include stoppedWATCHTOWER_INCLUDE_STOPPED=trueUpdate stopped containers too
Rolling restartWATCHTOWER_ROLLING_RESTART=trueOne container at a time
CleanupWATCHTOWER_CLEANUP=trueRemove old images after update

Notification Channels

ChannelEnvironment Variable Example
SlackWATCHTOWER_NOTIFICATION_URL=slack://hook.slack.com/services/xxx
DiscordWATCHTOWER_NOTIFICATION_URL=discord://token@webhookid
TelegramWATCHTOWER_NOTIFICATION_URL=telegram://token@telegram?chats=chatid
EmailWATCHTOWER_NOTIFICATION_URL=smtp://user:pass@host:port/?to=you@email.com
GotifyWATCHTOWER_NOTIFICATION_URL=gotify://host/token

Containers to Exclude (Best Practice)

Container TypeWhy ExcludeRecommended
Databases (Postgres, MySQL, Redis)Schema migrations, data integrityMonitor-only
Production APIsBreaking changes, downtime riskMonitor-only
Stateful apps (Nextcloud, GitLab)Migration steps requiredMonitor-only
Helper containers (nginx, redis-cache)Low risk, quick restartAuto-update
Monitoring (Uptime Kuma, Glances)Low riskAuto-update

Troubleshooting

ProblemSolution
Container not updatingCheck it’s not excluded via label; verify image tag isn’t pinned to SHA
Private registry authMount ~/.docker/config.json into the Watchtower container
Updates happening too oftenSwitch from latest tag to specific version tags
Notification not receivedTest the Shoutrrr URL with docker run containrrr/shoutrrr send ...

Summary

  • Set-and-forget Docker container updates on your schedule.
  • Per-container control — auto-update, monitor-only, or exclude.
  • Multi-channel notifications — know when updates happen.
  • Best practice: auto-update stateless tools, monitor-only for databases and stateful apps.