watchtower

command module
v1.21.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

README ΒΆ

Watchtower

Automate Docker container image updates

All Contributors Build codecov Codacy Badge GHCR GoDoc Ask DeepWiki Apache-2.0 License latest version

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 \
    ghcr.io/sidneyojr/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 enabled with CI/CD, such as onedr0p's Talos Linux with FluxCD setup here.

⚠️ Note: It is recommended to use the latest version of Docker. You can check your host's Docker version using the CLI command docker version. This version of Watchtower has been tested to support v1.43 and higher; however, don't be surprised if you experience unexpected behavior when attempting to use newer features on older versions of Docker. This version autonegotiates the API version by default. If the DOCKER_API_VERSION variable is explicitly set, Watchtower validates the version and falls back to autonegotiation on failure.

Supported Architectures

Watchtower supports the following architectures for its Docker images:

  • amd64
  • i386
  • armhf
  • arm64v8
  • riscv64

Documentation

The full documentation is available at https://sidneyojr.github.io/watchtower/.

Contributors

Thanks goes to these wonderful people (emoji key):

Nicholas Fedor
Nicholas Fedor

πŸ’» πŸ“– 🚧 πŸ‘€
Dirk Kok
Dirk Kok

πŸ’»
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

πŸ’»
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

πŸ“–
EDIflyer
EDIflyer

πŸ“–
Jauder Ho
Jauder Ho

πŸ’»
Andrii Bratanin
Andrii Bratanin

πŸ“–
Tamal Das
Tamal Das

πŸ“–
guangwu
guangwu

πŸ“–
Florian HΓΌbner
Florian HΓΌbner

πŸ“– πŸ’»
yubiuser
yubiuser

πŸ’»
RoboMagus
RoboMagus

πŸš‡
AzariasB
AzariasB

πŸ“–
ApprenticeofEnder
ApprenticeofEnder

πŸ’»
skylenet
skylenet

πŸ’»
Varun Chawla
Varun Chawla

πŸ’»
LJspice
LJspice

πŸ’»
Barnabas Busa
Barnabas Busa

πŸ’» πŸ“–
Matthias Thubauville
Matthias Thubauville

πŸ“–
Gauthier Painteaux
Gauthier Painteaux

πŸ’» ⚠️ πŸ“–

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

Documentation ΒΆ

Overview ΒΆ

@title Watchtower HTTP API @version 1.0 @description Watchtower HTTP API for container update management, metrics, and health probes. @contact.name sidneyojr @contact.url https://github.com/sidneyojr/watchtower @license.name MIT @license.url https://opensource.org/licenses/MIT @host localhost:8080 @BasePath / @schemes http https @accept json @produce json @securityDefinitions.apikey BearerAuth @in header @name Authorization @description Paste the HTTP API token only (WATCHTOWER_HTTP_API_TOKEN). Swagger UI sends it as the Authorization header value. curl clients should use "Authorization: Bearer <token>". @securityDefinitions.apikey EventsToken @in header @name Authorization @description Paste the events API token only (WATCHTOWER_HTTP_API_EVENTS_TOKEN). Swagger UI sends it as the Authorization header value. @tag.name health @tag.description Standardized liveness, readiness, and startup probes @tag.name update @tag.description Trigger and manage container image updates @tag.name metrics @tag.description Prometheus metrics and scan status @tag.name containers @tag.description Watched container image identity and update availability @tag.name check @tag.description Check for available container updates without applying them @tag.name history @tag.description Historical scan results from the in-memory ring buffer @tag.name images @tag.description Tracked images with digests and container counts @tag.name config @tag.description Active Watchtower configuration settings @tag.name events @tag.description Real-time operational events via Server-Sent Events

Directories ΒΆ

Path Synopsis
Package cmd contains the command-line interface (CLI) definitions and execution logic for Watchtower.
Package cmd contains the command-line interface (CLI) definitions and execution logic for Watchtower.
examples
lifecycle-hooks/synology-stop command
Package synology-stop is a Watchtower "stop" lifecycle hook that performs graceful Docker container shutdown on Synology DSM using the official Web API.
Package synology-stop is a Watchtower "stop" lifecycle hook that performs graceful Docker container shutdown on Synology DSM using the official Web API.
internal
actions
Package actions provides core logic for Watchtower's container update operations.
Package actions provides core logic for Watchtower's container update operations.
actions/mocks
Package mocks provides mock implementations for testing Watchtower components.
Package mocks provides mock implementations for testing Watchtower components.
api
Package api provides Watchtower's HTTP API server, built on Fiber v3.
Package api provides Watchtower's HTTP API server, built on Fiber v3.
api/config
Package config defines the shared configuration types, validation functions, and sentinel errors used across the API packages.
Package config defines the shared configuration types, validation functions, and sentinel errors used across the API packages.
api/handlers/check
Package check provides the /v1/check endpoint for read-only update availability checks.
Package check provides the /v1/check endpoint for read-only update availability checks.
api/handlers/config
Package config provides the HTTP handler for the /v1/config endpoint.
Package config provides the HTTP handler for the /v1/config endpoint.
api/handlers/containers
Package containers provides the /v1/containers HTTP API endpoint, exposing the current image identity (name, local ID, and registry manifest digest) of each container Watchtower watches.
Package containers provides the /v1/containers HTTP API endpoint, exposing the current image identity (name, local ID, and registry manifest digest) of each container Watchtower watches.
api/handlers/containers/details
Package details provides the /v1/containers/details HTTP API endpoint, exposing detailed information about a single watched container including its image identity, digest, and update availability status.
Package details provides the /v1/containers/details HTTP API endpoint, exposing detailed information about a single watched container including its image identity, digest, and update availability status.
api/handlers/events
Package events provides the /v1/events HTTP API endpoint for real-time Server-Sent Events (SSE).
Package events provides the /v1/events HTTP API endpoint for real-time Server-Sent Events (SSE).
api/handlers/health
Package health provides HTTP health check handlers for Watchtower.
Package health provides HTTP health check handlers for Watchtower.
api/handlers/history
Package history provides the /v1/history HTTP API endpoint, exposing historical scan results from the in-memory ring buffer (up to 500 entries).
Package history provides the /v1/history HTTP API endpoint, exposing historical scan results from the in-memory ring buffer (up to 500 entries).
api/handlers/images
Package images provides the /v1/images HTTP API endpoint, exposing the current image identity (name, local ID, registry manifest digest) and container count for each image Watchtower tracks.
Package images provides the /v1/images HTTP API endpoint, exposing the current image identity (name, local ID, registry manifest digest) and container count for each image Watchtower tracks.
api/handlers/metrics
Package metrics provides the /v1/metrics HTTP API endpoint for serving Prometheus metrics.
Package metrics provides the /v1/metrics HTTP API endpoint for serving Prometheus metrics.
api/handlers/update
Package update provides an HTTP API handler for triggering Watchtower container updates.
Package update provides an HTTP API handler for triggering Watchtower container updates.
api/routes
Package routes registers all enabled API endpoints on a Fiber application.
Package routes registers all enabled API endpoints on a Fiber application.
api/swagger
Package swagger Code generated by swaggo/swag.
Package swagger Code generated by swaggo/swag.
config
Package config resolves process configuration into a single immutable Config.
Package config resolves process configuration into a single immutable Config.
config/api
Package api holds HTTP API transport and endpoint settings.
Package api holds HTTP API transport and endpoint settings.
config/client
Package client holds Docker client construction options derived from flags.
Package client holds Docker client construction options derived from flags.
config/compatibility
Package compatibility holds runtime compatibility settings (for example Podman).
Package compatibility holds runtime compatibility settings (for example Podman).
config/docker
Package docker holds Docker API connection settings.
Package docker holds Docker API connection settings.
config/filter
Package filter holds container selection inputs and the resolved filter.
Package filter holds container selection inputs and the resolved filter.
config/lifecycle
Package lifecycle holds pre/post update lifecycle hook settings.
Package lifecycle holds pre/post update lifecycle hook settings.
config/logging
Package logging holds console logging settings.
Package logging holds console logging settings.
config/mode
Package mode holds process entry-shape settings.
Package mode holds process entry-shape settings.
config/notify
Package notify holds notification settings for the config domain.
Package notify holds notification settings for the config domain.
config/registry
Package registry holds registry TLS settings.
Package registry holds registry TLS settings.
config/schedule
Package schedule holds poll interval and cron schedule settings.
Package schedule holds poll interval and cron schedule settings.
config/update
Package update holds container update policy settings.
Package update holds container update policy settings.
flags
Package flags manages command-line flags and environment variables for Watchtower configuration.
Package flags manages command-line flags and environment variables for Watchtower configuration.
flags/api
Package api registers HTTP API transport and endpoint flags.
Package api registers HTTP API transport and endpoint flags.
flags/client
Package client registers Docker client construction flags.
Package client registers Docker client construction flags.
flags/compat
Package compat registers runtime compatibility flags.
Package compat registers runtime compatibility flags.
flags/docker
Package docker registers Docker API client flags.
Package docker registers Docker API client flags.
flags/filter
Package filter registers container selection flags.
Package filter registers container selection flags.
flags/lifecycle
Package lifecycle registers pre/post update lifecycle hook flags.
Package lifecycle registers pre/post update lifecycle hook flags.
flags/logging
Package logging registers console logging flags.
Package logging registers console logging flags.
flags/mode
Package mode registers process entry-shape flags.
Package mode registers process entry-shape flags.
flags/notify
Package notify registers notification-related CLI and environment flags.
Package notify registers notification-related CLI and environment flags.
flags/registry
Package registry registers registry TLS flags.
Package registry registers registry TLS flags.
flags/schedule
Package schedule registers poll interval and cron schedule flags.
Package schedule registers poll interval and cron schedule flags.
flags/spec
Package spec defines shared flag metadata used by domain registration and Viper bind.
Package spec defines shared flag metadata used by domain registration and Viper bind.
flags/update
Package update registers container update policy flags.
Package update registers container update policy flags.
flags/utils
Package utils provides shared helpers for flag registration and value parsing.
Package utils provides shared helpers for flag registration and value parsing.
logging
Package logging provides zerolog construction and configuration helpers for Watchtower.
Package logging provides zerolog construction and configuration helpers for Watchtower.
meta
Package meta provides centralized application metadata for Watchtower.
Package meta provides centralized application metadata for Watchtower.
metrics
Package metrics provides tracking and exposure of Watchtower scan metrics.
Package metrics provides tracking and exposure of Watchtower scan metrics.
scheduling
Package scheduling provides functionality for scheduling and executing container updates in Watchtower.
Package scheduling provides functionality for scheduling and executing container updates in Watchtower.
util
Package util provides utility functions for Watchtower operations.
Package util provides utility functions for Watchtower operations.
pkg
compose
Package compose provides functionality for handling Docker Compose-specific logic, including parsing depends_on labels and extracting service names for dependency management.
Package compose provides functionality for handling Docker Compose-specific logic, including parsing depends_on labels and extracting service names for dependency management.
container
Package container provides functionality for managing Docker containers in Watchtower.
Package container provides functionality for managing Docker containers in Watchtower.
container/mocks
Package mocks provides hand-written HTTP API fixtures and Mockery-generated doubles for container package tests.
Package mocks provides hand-written HTTP API fixtures and Mockery-generated doubles for container package tests.
filters
Package filters provides filtering logic for Watchtower containers.
Package filters provides filtering logic for Watchtower containers.
lifecycle
Package lifecycle manages execution of lifecycle hooks for Watchtower containers.
Package lifecycle manages execution of lifecycle hooks for Watchtower containers.
notifications
Package notifications provides the notification client for sending Watchtower update messages.
Package notifications provides the notification client for sending Watchtower update messages.
registry
Package registry provides functionality for interacting with container registries in Watchtower.
Package registry provides functionality for interacting with container registries in Watchtower.
registry/auth
Package auth implements the Docker Registry HTTP API V2 authentication protocol.
Package auth implements the Docker Registry HTTP API V2 authentication protocol.
registry/digest
Package digest provides functionality for retrieving and comparing Docker image digests in Watchtower.
Package digest provides functionality for retrieving and comparing Docker image digests in Watchtower.
registry/manifest
Package manifest provides functionality for constructing URLs to access container image manifests in Watchtower.
Package manifest provides functionality for constructing URLs to access container image manifests in Watchtower.
session
Package session manages container states and reporting during a Watchtower update session.
Package session manages container states and reporting during a Watchtower update session.
sorter
Package sorter provides sorting functionality for Watchtower containers.
Package sorter provides sorting functionality for Watchtower containers.
sorter/mocks
Package mocks provides mock implementations for container interfaces used in testing.
Package mocks provides mock implementations for container interfaces used in testing.
types
Package types defines core interfaces and structs for Watchtower.
Package types defines core interfaces and structs for Watchtower.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL