Compose: usar restart unless-stopped, flags en command, schedule 03:30, cleanup y socket ro

This commit is contained in:
2025-11-30 12:04:53 +01:00
parent 1dd30804e7
commit 4629bf255d

View File

@@ -2,19 +2,24 @@ services:
watchtower: watchtower:
image: containrrr/watchtower:latest image: containrrr/watchtower:latest
container_name: watchtower container_name: watchtower
restart: always restart: unless-stopped
environment: environment:
- TZ=Europe/Madrid - TZ=Europe/Madrid
- WATCHTOWER_CLEANUP=true services:
- WATCHTOWER_INCLUDE_STOPPED=false watchtower:
- WATCHTOWER_SCHEDULE=0 0 3 * * * image: containrrr/watchtower:latest
# Notificaciones (ejemplos): container_name: watchtower
# - WATCHTOWER_NOTIFICATIONS=shoutrrr restart: unless-stopped
# - WATCHTOWER_NOTIFICATION_URL=telegram://token@chatid environment:
volumes: - TZ=Europe/Madrid
- /var/run/docker.sock:/var/run/docker.sock volumes:
command: --label-enable - /var/run/docker.sock:/var/run/docker.sock:ro
command:
- --label-enable # Solo contenedores con label enable=true
- --cleanup # Elimina imágenes antiguas tras actualizar
- --schedule=0 30 3 * * * # Ejecuta cada día a las 03:30
- --stop-timeout=30s # Tiempo de gracia al parar contenedores
# Etiqueta tus servicios para que watchtower los actualice: # Añade en cada servicio que quieras actualizar:
# labels: # labels:
# - "com.centurylinklabs.watchtower.enable=true" # - "com.centurylinklabs.watchtower.enable=true"