Top Related Projects
An open source trusted cloud native registry project that stores, signs, and scans content.
Making Docker and Kubernetes management easy.
Automatically update running docker containers with newest available image
Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
Quick Overview
Watchtower is an automated Docker container update tool. It monitors running containers and checks for newer images, automatically updating and restarting containers when a new version is available. This helps maintain up-to-date and secure Docker environments with minimal manual intervention.
Pros
- Automatic updates: Keeps containers up-to-date without manual intervention
- Flexible configuration: Supports various update schedules and notification options
- Secure: Can use private registries and supports authentication
- Easy to set up: Can be run as a Docker container itself
Cons
- Potential downtime: Container restarts may cause brief service interruptions
- Limited control: Automatic updates may introduce unexpected changes or issues
- Resource intensive: Constant checking for updates can consume network and CPU resources
- Dependency conflicts: Updating containers may lead to compatibility issues with other services
Getting Started
To get started with Watchtower, you can run it as a Docker container:
docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower
This command will start Watchtower in the background, monitoring all running containers and updating them when new images are available.
To customize Watchtower's behavior, you can use environment variables:
docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
-e WATCHTOWER_POLL_INTERVAL=86400 \
-e WATCHTOWER_CLEANUP=true \
containrrr/watchtower
This example sets the polling interval to 24 hours (86400 seconds) and enables cleanup of old images after updates.
For more advanced configurations, you can use a config file:
# /path/to/config.json
{
"cleanup": true,
"include-stopped": true,
"notifications": {
"slack": {
"hook_url": "https://hooks.slack.com/services/xxx/yyy/zzz",
"identifier": "watchtower-server-1"
}
}
}
Then run Watchtower with the config file:
docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /path/to/config.json:/config.json \
containrrr/watchtower
This setup includes stopped containers in the update process and sends notifications to Slack when updates occur.
Competitor Comparisons
An open source trusted cloud native registry project that stores, signs, and scans content.
Pros of Harbor
- Comprehensive container registry with advanced features like image scanning, replication, and RBAC
- Supports multiple authentication backends and integrates with enterprise systems
- Provides a web-based user interface for easy management and monitoring
Cons of Harbor
- More complex setup and maintenance compared to Watchtower's simplicity
- Requires more resources to run due to its extensive feature set
- May be overkill for small-scale deployments or simple container update needs
Code Comparison
Harbor (configuration example):
harbor:
adminPassword: Harbor12345
externalURL: https://harbor.example.com
persistence:
enabled: true
storageClass: "nfs-client"
Watchtower (configuration example):
version: "3"
services:
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 30
Harbor is a full-featured container registry solution, while Watchtower focuses solely on automating container updates. Harbor offers more comprehensive management capabilities, but Watchtower excels in simplicity for keeping containers up-to-date with minimal configuration.
Making Docker and Kubernetes management easy.
Pros of Portainer
- Provides a comprehensive GUI for managing Docker environments
- Offers user management and access control features
- Supports multiple Docker environments and orchestration platforms
Cons of Portainer
- More resource-intensive due to its full-featured nature
- Requires additional setup and configuration compared to Watchtower
Code Comparison
Watchtower (typically run as a Docker container):
version: "3"
services:
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 30
Portainer (basic Docker Compose setup):
version: "3"
services:
portainer:
image: portainer/portainer-ce
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
ports:
- "9000:9000"
Watchtower focuses solely on automatic container updates, while Portainer offers a full-featured management interface for Docker environments. Watchtower is lightweight and requires minimal configuration, making it ideal for simple update automation. Portainer, on the other hand, provides a more comprehensive solution for Docker management, including a web-based UI, user access control, and support for various Docker platforms, but comes with increased complexity and resource usage.
Automatically update running docker containers with newest available image
Pros of Ouroboros
- Written in Python, which may be more accessible for some developers
- Supports monitoring and updating non-Docker applications
- Offers more granular control over update schedules
Cons of Ouroboros
- Less actively maintained compared to Watchtower
- Smaller community and fewer contributors
- May have fewer features and integrations
Code Comparison
Watchtower (Go):
func (client *Client) getContainers(names []string) ([]container.Container, error) {
containers, err := client.api.ContainerList(context.Background(), types.ContainerListOptions{})
if err != nil {
return nil, err
}
return containers, nil
}
Ouroboros (Python):
def get_running_containers():
try:
return cli.containers(filters={'status': 'running'})
except APIError as err:
logger.error(err)
return []
Both projects aim to automatically update Docker containers, but they differ in implementation language and some features. Watchtower is more widely used and actively maintained, while Ouroboros offers some unique capabilities. The code snippets show similar functionality for retrieving container lists, with Watchtower using Go and Ouroboros using Python.
Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
Pros of Renovate
- Supports a wide range of package managers and languages, not limited to Docker
- Offers granular control over update strategies and scheduling
- Provides detailed changelogs and release notes for updates
Cons of Renovate
- More complex setup and configuration compared to Watchtower
- Requires direct access to source code repositories
Code Comparison
Watchtower (Docker-based):
version: "3"
services:
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 30
Renovate (Configuration file):
{
"extends": ["config:base"],
"packageRules": [
{
"updateTypes": ["minor", "patch"],
"automerge": true
}
]
}
Watchtower focuses on simplicity and automatic Docker container updates, while Renovate offers a more comprehensive and flexible approach to dependency management across various ecosystems. Watchtower is easier to set up but has limited customization options, whereas Renovate provides extensive configuration capabilities but requires more initial setup and integration with source control systems.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Quick Start
With watchtower you can update the running version of your containerized app simply by pushing a new image to the Docker Hub or your own image registry.
Watchtower will pull down your new image, gracefully shut down your existing container and restart it with the same options that were used when it was deployed initially. Run the watchtower container with the following command:
$ docker run --detach \
--name watchtower \
--volume /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower
Watchtower is intended to be used in homelabs, media centers, local dev environments, and similar. We do not recommend using Watchtower in a commercial or production environment. If that is you, you should be looking into using Kubernetes. If that feels like too big a step for you, please look into solutions like MicroK8s and k3s that take away a lot of the toil of running a Kubernetes cluster.
Documentation
The full documentation is available at https://containrrr.dev/watchtower.
Contributors
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Top Related Projects
An open source trusted cloud native registry project that stores, signs, and scans content.
Making Docker and Kubernetes management easy.
Automatically update running docker containers with newest available image
Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot