Watchtower is a small container that watches the registry for new image tags, pulls them, and restarts containers using the affected images. For a home lab or a small single-host deployment where you trust the image author and accept rolling updates, it’s the simplest answer to “keep my containers patched without me thinking about it.” For anything regulated, customer-facing, or version-pinned, it’s the wrong tool — and this article covers the line.
How to verify
Check whether Watchtower is running and what it’s been configured to do:
docker ps --filter ancestor=containrrr/watchtower
docker logs watchtower --tail 50
docker inspect watchtower --format '{{json .Config.Env}}' | jq
# Which containers are eligible for auto-update?
docker ps --format "table {{.Names}}\t{{.Labels}}" | grep -i watchtower
If WATCHTOWER_LABEL_ENABLE=true is set and only specific containers carry com.centurylinklabs.watchtower.enable=true, Watchtower is in opt-in mode (the safer default). If neither label nor env var is set, it auto-updates everything on the host — usually the wrong scope for anything non-trivial.
What’s happening
Watchtower polls the registry on a schedule. For each container it manages, it inspects the running container’s image, asks the registry “do you have a newer manifest for this tag?”, and if so, pulls the new image, recreates the container with the same parameters, and removes the old image.
The mechanics are simple. The implications are not:
- Tag, not digest. Watchtower follows tags (
myapp:1,myapp:latest). If your tag floats —latest, a major version — any push by the image author becomes a deploy. There’s no review. - No staging gate. The next pull from the registry hits production. No staging, no smoke test, no approval.
- Brief outage per update. Each container is recreated, which means a few seconds of unavailability for that service. Multi-replica orchestrators (Swarm, k8s) do this gracefully; single-container hosts have a small downtime.
- Trust transfer. You’re trusting every image author on your host as much as you trust yourself. A compromised upstream tag becomes your problem within hours.
For homelab and small-team setups (Pi-hole, Home Assistant, monitoring stack, an internal dashboard), the trade-offs are fine. For client-facing production, they’re not.
The procedure
- Run Watchtower in opt-in mode — only containers explicitly labeled get updated:
# compose.yaml
services:
watchtower:
image: containrrr/watchtower:latest
restart: unless-stopped
environment:
WATCHTOWER_LABEL_ENABLE: "true" # opt-in via label
WATCHTOWER_CLEANUP: "true" # remove old images after update
WATCHTOWER_INCLUDE_RESTARTING: "true"
WATCHTOWER_INCLUDE_STOPPED: "false"
WATCHTOWER_POLL_INTERVAL: "3600" # 1 hour
WATCHTOWER_NOTIFICATIONS: "shoutrrr"
WATCHTOWER_NOTIFICATION_URL: "slack://hook:T00000000/B00000000/XXX"
WATCHTOWER_NOTIFICATION_REPORT: "true"
TZ: "America/Toronto"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
command: --rolling-restart --label-enable
Critical notes:
WATCHTOWER_LABEL_ENABLE=trueplus--label-enablemeans containers without the enable label are left alone. Default-deny.- Watchtower needs the Docker socket. That’s a privileged container — treat it as such. The
:romakes the bind read-only (Watchtower can still control containers because the socket itself is bidirectional). WATCHTOWER_NOTIFICATIONSposts a summary to Slack/Discord/email on every cycle. Read the notifications — they’re how you find out which containers updated.
- Label the containers you want auto-updated:
services:
pihole:
image: pihole/pihole:latest
labels:
- "com.centurylinklabs.watchtower.enable=true"
homeassistant:
image: homeassistant/home-assistant:stable
labels:
- "com.centurylinklabs.watchtower.enable=true"
myapp-prod:
image: ghcr.io/example/myapp:1.42.0
# NO label = not eligible for auto-update — this is the production app
-
Tune the polling cadence. Default is 24 hours (
86400seconds). For a homelab, 1-6 hours is reasonable. For anything where image author push frequency matters, match the cadence to what you can tolerate as deploy latency. -
Configure notifications so you have a record. Without notifications, Watchtower silently rolls and you find out via a misbehaving container:
environment:
WATCHTOWER_NOTIFICATIONS: "shoutrrr"
WATCHTOWER_NOTIFICATION_URL: |
slack://hook:T00000000/B00000000/XXX
WATCHTOWER_NOTIFICATION_TEMPLATE: |
{{range .}}{{.Container}}: {{.Old.ImageID}} -> {{.New.ImageID}}
{{end}}
The shoutrrr syntax supports Slack, Discord, Telegram, generic SMTP, ntfy, and a dozen others.
- For specific images you want auto-updated but at a controlled cadence, use scope filtering. Watchtower can run multiple instances on the same host, each watching a subset:
services:
watchtower-fast:
image: containrrr/watchtower:latest
environment:
WATCHTOWER_SCOPE: "homelab"
WATCHTOWER_POLL_INTERVAL: "3600"
command: --scope homelab --rolling-restart
watchtower-slow:
image: containrrr/watchtower:latest
environment:
WATCHTOWER_SCOPE: "weekly"
WATCHTOWER_POLL_INTERVAL: "604800" # weekly
command: --scope weekly --rolling-restart
And label containers with com.centurylinklabs.watchtower.scope=homelab (or weekly).
- Lifecycle hooks let you run scripts before/after an update — useful for backups:
services:
myapp:
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "com.centurylinklabs.watchtower.lifecycle.pre-update=/scripts/backup-before-update.sh"
- "com.centurylinklabs.watchtower.lifecycle.post-update=/scripts/smoke-test.sh"
The scripts run inside the container being updated. Exit code 1 from pre-update aborts the update; the container is left on the old image. Useful for snapshotting a SQLite DB or running a quick health probe.
-
For production, the right answer is usually NOT Watchtower:
- Renovate or Dependabot opens a PR when a new image is available. CI builds, tests, deploys via your normal pipeline.
- An orchestrator’s native update flow (
kubectl set image, ArgoCD, Flux,docker service update) gives you rollback, health gating, canary, and audit trail. - A nightly registry sync + redeploy script in CI gives you the same auto-update behavior but inside your deploy pipeline, with monitoring and approvals.
For client environments, we use those patterns. Watchtower stays on the homelab.
Common pitfalls
- Running Watchtower in default mode (no opt-in label) on a host with mixed workloads — that production container gets auto-updated against your intent.
- Pinning
image: myapp:1.42.0and expecting Watchtower to track minor versions — Watchtower only follows the exact tag.myapp:1.42.0will never auto-update; you wantedmyapp:1. - Forgetting that Watchtower has full Docker socket access. A compromised Watchtower image is a host root compromise.
- Letting Watchtower auto-update itself (
com.centurylinklabs.watchtower.enable=trueon Watchtower itself). On a botched upstream release, Watchtower can break in a way that leaves containers it manages stranded. - Skipping notifications and discovering via outage that a backwards-incompatible image change rolled overnight.
For client deployments we run, image updates flow through CI: PR opened by Renovate, tested, deployed via the same pipeline that handles every other release. Watchtower has a home — it’s just not in managed operations. For homelab and internal-tool setups where it does fit, the opt-in label model and notification routing make it controllable.