Watchtower
A process for automating Docker container base image updates.
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.
Setting up
Section titled “Setting up”watchtower_enabled: trueWatchtower will automatically monitor and update all other Docker containers.
Configuration
Section titled “Configuration”See the default configuration options for Watchtower at roles/watchtower/defaults/main.yml.
Add any overrides to your inventories/[your_inventory]/group_vars/homelab.yml file.
Prometheus metrics
Section titled “Prometheus metrics”Watchtower can publish metrics (containers scanned/updated/failed/skipped, scan counts) to
Prometheus for monitoring. This requires prometheus_enabled: true.
Enable it and set a bearer token Prometheus uses to authenticate — generate one with
openssl rand -hex 32:
watchtower_metrics_enabled: truewatchtower_metrics_token: "your-generated-token"watchtower_ephemeral_self_update_enabled: trueThen import the dashboard from the Watchtower repo’s examples/metrics/grafana/dashboards/dashboard.json
to visualize the data.