Convert Figma logo to code with AI

containrrr logowatchtower

A process for automating Docker container base image updates.

18,342
830
18,342
163

Top Related Projects

23,618

An open source trusted cloud native registry project that stores, signs, and scans content.

30,364

Making Docker and Kubernetes management easy.

Automatically update running docker containers with newest available image

17,095

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

23,618

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.

30,364

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.

17,095

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 Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Watchtower

A process for automating Docker container base image updates.

Circle CI codecov GoDoc Go Report Card latest version Apache-2.0 License Codacy Badge All Contributors Pulls from DockerHub

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):

nils måsén
nils måsén

💻 📖 🚧 👀
Simon Aronsson
Simon Aronsson

💻 📖 🚧 👀
James
James

⚠️ 🤔
Florian
Florian

👀 📖
Brian DeHamer
Brian DeHamer

💻 🚧
Ross Cadogan
Ross Cadogan

💻
stffabi
stffabi

💻 🚧
Austin
Austin

📖
David Gardner
David Gardner

👀 📖
Tanguy ⧓ Herrmann
Tanguy ⧓ Herrmann

💻
Rodrigo Damazio Bovendorp
Rodrigo Damazio Bovendorp

💻 📖
Ryan Kuba
Ryan Kuba

🚇
cnrmck
cnrmck

📖
Harry Walter
Harry Walter

💻
Robotex
Robotex

📖
Gerald Pape
Gerald Pape

📖
fomk
fomk

💻
Sven Gottwald
Sven Gottwald

🚇
techknowlogick
techknowlogick

💻
waja
waja

📖
Scott Albertson
Scott Albertson

📖
Jason Huddleston
Jason Huddleston

📖
Napster
Napster

💻
Maxim
Maxim

💻 📖
Max Schmitt
Max Schmitt

📖
cron410
cron410

📖
Paulo Henrique
Paulo Henrique

📖
Kaleb Elwert
Kaleb Elwert

📖
Bill Butler
Bill Butler

📖
Mario Tacke
Mario Tacke

💻
Mark Woodbridge
Mark Woodbridge

💻
Ansem93
Ansem93

📖
Luka Peschke
Luka Peschke

💻 📖
Zois Pagoulatos
Zois Pagoulatos

💻 👀 🚧
Alexandre Menif
Alexandre Menif

💻
Andrey
Andrey

📖
Armando Lüscher
Armando Lüscher

📖
Ryan Budke
Ryan Budke

📖
Kaloyan Raev
Kaloyan Raev

💻 ⚠️
sixth
sixth

📖
Gina Häußge
Gina Häußge

💻
Max H.
Max H.

💻
Jungkook Park
Jungkook Park

📖
Jan Kristof Nidzwetzki
Jan Kristof Nidzwetzki

📖
lukas
lukas

💻
Ameya Shenoy
Ameya Shenoy

💻
Raymon de Looff
Raymon de Looff

💻
John Clayton
John Clayton

💻
Germs2004
Germs2004

📖
Lukas Willburger
Lukas Willburger

💻
Oliver Cervera
Oliver Cervera

📖
Victor Moura
Victor Moura

⚠️ 💻 📖
Maximilian Brandau
Maximilian Brandau

💻 ⚠️
Andrew
Andrew

📖
sixcorners
sixcorners

📖
Arne Jørgensen
Arne Jørgensen

⚠️ 👀
PatSki123
PatSki123

📖
Valentine Zavadsky
Valentine Zavadsky

💻 📖 ⚠️
Alexander Voronin
Alexander Voronin

💻 🐛
Oliver Mueller
Oliver Mueller

📖
Sebastiaan Tammer
Sebastiaan Tammer

💻
miosame
miosame

📖
Andrew Metzger
Andrew Metzger

🐛 💡
Pierre Grimaud
Pierre Grimaud

📖
Matt Doran
Matt Doran

📖
MihailITPlace
MihailITPlace

💻
bugficks
bugficks

💻 📖
Michael
Michael

💻
D. Domig
D. Domig

📖
Ben Osheroff
Ben Osheroff

💻
David H.
David H.

💻
Chander Ganesan
Chander Ganesan

📖
yrien30
yrien30

💻
ksurl
ksurl

📖 💻 🚇
rg9400
rg9400

💻
Turtle Kalus
Turtle Kalus

💻
Srihari Thalla
Srihari Thalla

📖
Thomas Gaudin
Thomas Gaudin

📖
hydrargyrum
hydrargyrum

📖
Reinout van Rees
Reinout van Rees

📖
DasSkelett
DasSkelett

💻
zenjabba
zenjabba

📖
Dan Quan
Dan Quan

📖
modem7
modem7

📖
Igor Zibarev
Igor Zibarev

💻
Patrice
Patrice

💻
James White
James White

📖
Dirk Kok
Dirk Kok

💻
EDIflyer
EDIflyer

📖
Jauder Ho
Jauder Ho

💻
Tamal Das
Tamal Das

📖
guangwu
guangwu

📖
Florian Hübner
Florian Hübner

📖 💻

Andrii Bratanin

📖

This project follows the all-contributors specification. Contributions of any kind welcome!