version: "3.9"
services:
watchtower:
container_name: watchtower
image: containrrr/watchtower:amd64-latest
restart: unless-stopped
environment:
- TZ=Europe/Paris
- WATCHTOWER_SCHEDULE= 0 0 6 * * *
- WATCHTOWER_LABEL_ENABLE=true
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_REMOVE_VOLUMES=true
- WATCHTOWER_NOTIFICATIONS_LEVEL=debug
- WATCHTOWER_NOTIFICATION_EMAIL_FROM = fromaddress@mymail.com
- WATCHTOWER_NOTIFICATION_EMAIL_TO = toaddress@mymail.com
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER = smtp.server.com
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT = 587
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER = fromaddress@mymail.com
- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD = myappspecificpassword
- WATCHTOWER_NOTIFICATION_EMAIL_DELAY = 2
- WATCHTOWER_NOTIFICATIONS = email
volumes:
- /var/run/docker.sock:/var/run/docker.sock
Pour que les conteneurs soient pris en compte par Watchtower, il faudra leur ajouter un label correspondant à ce qui devra être fait.
labels:
- com.centurylinklabs.watchtower.enable=true
labels:
- com.centurylinklabs.watchtower.monitor-only=true
labels:
- com.centurylinklabs.watchtower.enable=false
Attention : il est important de configurer les labels des conteneurs AVANT de lancer Watchtower pour éviter qu'ils soient mis à jour immédiatement.