Skip to content

watchtower handout

installation

services:
    watchtower:
        image: containrrr/watchtower:latest
        container_name: watchtower
        restart: unless-stopped
        labels:
            - "com.centurylinklabs.watchtower.enable=true"
        environment:
            TZ: "Europe/Zurich"
            WATCHTOWER_NOTIFICATIONS_HOSTNAME: <hostname>
            WATCHTOWER_INCLUDE_STOPPED: "true" ## also stopped container will be updated 
            WATCHTOWER_SCHEDULE: "0 0 6 * * SUN" ## every sunday at 0600
            WATCHTOWER_LABEL_ENABLE: "true" ## just update container with active labels
            WATCHTOWER_ROLLING_RESTART: "true" ## starting container one by one
            WATCHTOWER_CLEANUP: "true" ## removing old images
            WATCHTOWER_TIMEOUT: "60s" ## how many seconds before forcequit
            WATCHTOWER_NOTIFICATION_URL: "discord://<webhook>" ## translatet webhook from discord
            #WATCHTOWER_NOTIFICATION_TEMPLATE: "{{range .}}{{.Time.Format \"2006-01-02 15:04:05\"}} ({{.Level}}): {{.Message}}{{println}}{{end}}"
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock

configuration

labels: - "com.centurylinklabs.watchtower.enable=true"