services: watchtower: image: containrrr/watchtower container_name: watchtower volumes: - /var/run/docker.sock:/var/run/docker.sock # Connect to docker - $HOME/.docker/config.json:/config.json # Load docker config (for repository logins etc) environment: - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - TZ=Australia/Brisbane # Timezone.... wow.... - WATCHTOWER_NOTIFICATIONS=shoutrrr # Notifications through HTTP requests - WATCHTOWER_HTTP_API_UPDATE=true # Enable force update/scan via HTTP API - WATCHTOWER_SCHEDULE=0 0 4 * * * # Run at 4am every day (it's cron but with an extra place for seconds) - WATCHTOWER_CLEANUP=true # Delete old images - WATCHTOWER_NOTIFICATION_URL=generic://webhooktoolbox.com/api/webhooks// discord://@ # Notification URLs, separated by space, https://containrrr.dev/watchtower/notifications/ - WATCHTOWER_REVIVE_STOPPED=false # Don't start containers if they were stopped before update - WATCHTOWER_HTTP_API_METRICS=true # API metrics for dashboards et - WATCHTOWER_HTTP_API_PERIODIC_POLLS=true. # Enable the schedule with API active - WATCHTOWER_HTTP_API_TOKEN=password123 # Password for api - WATCHTOWER_LOG_LEVEL=info # panic, fatal, error, warn, info, debug or trace. - WATCHTOWER_INCLUDE_STOPPED=true # Update stopped containers - WATCHTOWER_NOTIFICATION_REPORT=true # Use the session report as the notification template data. - WATCHTOWER_NOTIFICATION_TITLE_TAG=yorgei # Title for notification - | # Giant ass template that sends things in a json (breaks on discord, using for wehbhooktoolbox) WATCHTOWER_NOTIFICATION_TEMPLATE={ "author": "yorgei", "title": "Watchtower Updates", "priority": 1, "logs": {{"[\"0\""}} {{- range .Entries -}}{{if .Message}}{{",\n"}}{{"\""}}{{- end -}} {{.Message}}{{"\""}}{{end}}{{"]"}} {{- if .Report }} {{- with .Report -}} ,{{println}}"messageFullText": "--------------\n\n**Scanned:** {{len .Scanned}}/{{len .Scanned}}\n\n**Updated:** {{len .Updated}}{{- range .Updated }}\n\n - {{.Name}} ({{.ImageName}}){{- end }}\n\n**Skipped:** {{len .Skipped}}{{- range .Skipped }}\n\n - {{.Name}} ({{.ImageName}})\n\n**Reason:** {{.Error}}{{- end }}\n\n**Failed:** {{len .Failed}}{{- range .Failed }}\n\n - {{.Name}} ({{.ImageName}})\n\n**Reason:** {{.Error}}{{- end }}", "message": "Scanned:{{len .Scanned}}/{{len .Scanned}}", "updatedCount": {{len .Updated}}, "updated": ["" {{- range .Updated -}} {{- if .Name}}, {{end}}"{{.Name}} ({{.ImageName}})" {{- end -}} ], "skippedCount": {{len .Skipped}}, "skipped": ["" {{- range .Skipped -}} {{- if .Name}}, {{end}}{"name":"{{.Name}} ({{.ImageName}})","reason":"{{.Error}}"} {{- end -}} ], "failedCount": {{len .Failed}}, "failed": ["" {{- range .Failed -}} {{- if .Name}}, {{end}}{"name":"{{.Name}} ({{.ImageName}})","reason":"{{.Error}}"} {{- end -}} ] {{- end }} {{- end }} } restart: always