Watchtower — Automated Docker Container Image Updates
Runs as a container itself, polls registries for new image tags, and gracefully redeploys running containers when updates appear.
What it is
Watchtower is a Docker container that monitors other running containers and automatically updates them when new images are pushed to their registries. It polls container registries at configurable intervals, pulls updated images, and gracefully stops and restarts containers with the same configuration.
Watchtower targets anyone running Docker containers in production or on home servers who wants automatic updates without manual intervention. It handles the entire lifecycle: detect, pull, stop, and restart.
How it saves time or tokens
Manually checking for Docker image updates and redeploying containers is tedious and easy to forget. Watchtower automates this entirely. It preserves container configurations (ports, volumes, environment variables) during updates, so you do not need to re-specify startup parameters. Notifications via email, Slack, or webhooks keep you informed about what was updated and when.
How to use
- Start Watchtower to monitor all containers:
docker run -d --name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower --interval 300 --cleanup
- Or monitor only specific containers by label:
# Add label to containers you want updated
docker run -d --label com.centurylinklabs.watchtower.enable=true my-app
# Run Watchtower with label filter
docker run -d --name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower --label-enable --interval 300
Example
# docker-compose.yml with Watchtower
services:
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 3600 --cleanup --notifications-level info
restart: unless-stopped
my-app:
image: myregistry/my-app:latest
labels:
- com.centurylinklabs.watchtower.enable=true
ports:
- '8080:8080'
restart: unless-stopped
Related on TokRepo
- DevOps Tools — Container and infrastructure management tools
- Self-Hosted Tools — Self-hosted infrastructure automation
This tool integrates with standard development workflows and requires minimal configuration to get started. It is available as open-source software with documentation and community support through the official repository. The project follows semantic versioning for stable releases.
For teams evaluating this tool, the key advantage is reducing manual work in repetitive tasks. The automation provided by the built-in features means less custom code to maintain and fewer integration points to manage. This translates directly to lower maintenance costs and faster iteration cycles.
Common pitfalls
- Watchtower requires access to the Docker socket (
/var/run/docker.sock), which grants full control over all containers; restrict access and do not expose it on untrusted networks. - Automatic updates can introduce breaking changes; use specific image tags or a staging environment rather than
:latestin production to control when updates apply. - The
--cleanupflag removes old images after updates to prevent disk space buildup; without it, old images accumulate over time.
Frequently Asked Questions
Yes. Watchtower supports private Docker registries with authentication. Mount your Docker config.json file or set registry credentials via environment variables so Watchtower can pull from private repositories.
Yes. Use the --label-enable flag to only update containers with a specific label. Alternatively, add the com.centurylinklabs.watchtower.enable=false label to containers you want to exclude.
There is a brief period between stopping the old container and starting the new one. For zero-downtime updates, you need a load balancer and multiple container instances. Watchtower is best suited for single-instance containers where brief interruptions are acceptable.
Watchtower supports email, Slack, Microsoft Teams, Gotify, and webhook notifications. Configure notification settings via environment variables or command-line flags.
Watchtower is widely used in production, especially for home servers and small deployments. For mission-critical production systems, consider using CI/CD pipelines with manual approval gates instead of fully automated updates.
Citations (3)
- Watchtower GitHub— Watchtower automatically updates running Docker containers
- Watchtower Documentation— Watchtower supports notification via email, Slack, and webhooks
- Watchtower Usage Guide— Watchtower preserves container configuration during updates
Related on TokRepo
Discussion
Related Assets
DTM — Distributed Transaction Manager for Microservices
A cross-language distributed transaction framework supporting Saga, TCC, XA, and two-phase message patterns for reliable microservice coordination.
WatermelonDB — Reactive Database for React Native Apps
A high-performance reactive database framework for React Native and React web apps, built on top of SQLite with lazy loading and sync primitives.
Dexie.js — Minimalist IndexedDB Wrapper for the Web
A lightweight wrapper around IndexedDB that provides a clean Promise-based API for client-side storage in web applications.