How nicholas-fedor/watchtower works
Watchtower automates Docker image updates: it discovers watched containers, checks registry digests or Git revisions, then replaces stale containers while preserving deployment settings. The CLI can run scans on a schedule or once; an HTTP API also exposes update, check, health, metrics, history, container, image, configuration, and event capabilities. Configuration and flags feed the runtime, while progress, metrics, and notifications report outcomes. Edges are limited to relationships visible in excerpts, the source index, or README; some API internals are documented but not sampled.
Main entry points: update.go Update action · root.go CLI orchestration · routes.go API routing · age.go Registry checks
Components 26
Runtime orchestration
- Process entry
main.go - CLI orchestration
cmd/root.go - Scheduled scans
internal/scheduling/scheduling.go
Update workflow
- Update action
internal/actions/update.go - Docker operations
pkg/container/client.go - Lifecycle hooks
pkg/lifecycle/lifecycle.go - Compose apply
internal/compose/client.go - Dependency ordering
pkg/sorter/dependency.go - Container filters
pkg/filters/filters.go
Image and Git checks
- Registry checks
pkg/registry/age.go - Registry authentication
pkg/registry/auth/auth.go - Digest resolution
internal/release/resolver.go - Git revision checks
internal/git/client.go
HTTP API
- API routing
internal/api/routes/routes.go - Update endpoint
internal/api/handlers/update/handler.go - Check endpoint
internal/api/handlers/check/handler.go - API capabilities
internal/api/handlers
Configuration and reporting
- Resolved configuration
internal/config - Flags and environment
internal/flags/flags.go - Metrics
internal/metrics/metrics.go - Scan reporting
pkg/session/report.go - Notifications
pkg/notifications/shoutrrr.go
Other components
- Operator
- Docker Engine
- Image registry
- Git host
Connections 29
- Operator → Process entry: starts
README.md - Process entry → CLI orchestration: delegates to
main.go - CLI orchestration → Resolved configuration: resolves
cmd/root.go - Flags and environment → Resolved configuration: configures
internal/flags/flags.go - CLI orchestration → Update action: runs updates
cmd/root.go - CLI orchestration → Scheduled scans: starts schedule
cmd/root.go - Scheduled scans → Update action: runs scans
internal/scheduling/scheduling.go - Update action → Container filters: filters containers
internal/actions/update.go - Update action → Dependency ordering: orders dependencies
internal/actions/update.go - Update action → Docker operations: updates containers
internal/actions/update.go - Update action → Lifecycle hooks: runs hooks
internal/actions/update.go - Update action → Compose apply: uses Compose
internal/actions/update.go - Update action → Git revision checks: checks revisions
internal/actions/update.go - Update action → Digest resolution: resolves releases
internal/actions/update.go - Digest resolution → Registry checks: checks digests
internal/release/resolver.go - Registry checks → Registry authentication: authenticates
pkg/registry/age.go - Registry checks → Image registry: queries
- Git revision checks → Git host: resolves refs
internal/git/client.go - Update action → Scan reporting: records progress
internal/actions/update.go - CLI orchestration → API routing: registers API
- API routing → Update endpoint: routes requests
- API routing → Check endpoint: routes requests
- API routing → API capabilities: mounts endpoints
internal/api/routes/routes.go - Update endpoint → Update action: invokes callback
internal/api/handlers/update/handler.go - Check endpoint → Notifications: sends results
internal/api/handlers/check/handler.go - Check endpoint → Scan reporting: checks containers
- Update action → Metrics: updates metrics
internal/actions/update.go - Scan reporting → Notifications: reports results
- Docker operations → Docker Engine: controls containers
README.md