Skip to content

Setup Watchtower

Overview

A process for automating Docker container base image updates.

Changelog

2025-01-26

  • Added Socket Proxy so Watchtower is not interacting with the docker socket directly
  • Changed Networks to the new network scheme (Main/Internal) instead of (Proxy/Internal).
  • Removed API Access from Watchtower as it isn't really needed and i wont be monitoring it anymore.
  • Fixed the connection between socket-proxy and watchtower.
  • Verified it is working properly to auto update the containers and remove previous images.

Important Docker Files

.env file

.env
TZ=America/New_York
KEY=
NAME=watchtower
DOMAIN=
PORT=8080
HOSTNAME=
NTFY

docker-compose.yml file

docker-compose.yml
services:
  watchtower:
    image: ghcr.io/containrrr/watchtower
    container_name: ${NAME}
    hostname: ${HOSTNAME}
    restart: unless-stopped
    networks:
      - main
    volumes:
      - /home/jonco/.docker/config.json:/config.json
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      TZ: ${TZ}
      WATCHTOWER_CLEANUP: "true"
      WATCHTOWER_INCLUDE_RESTARTING: "true"
      WATCHTOWER_LABEL_ENABLE: "true"
      WATCHTOWER_SCHEDULE: "* 0 * * * *" # Daily @ Midnight
      WATCHTOWER_WARN_ON_HEAD_FAILURE: never
      WATCHTOWER_NOTIFICATIONS: shoutrrr
      WATCHTOWER_NOTIFICATION_URL: ntfy://${NTFY}/Updates?title=WatchtowerUpdates
    labels:
      traefik.enable: false
      com.centurylinklabs.watchtower.enable: true
networks:
  main:
    external: true

Start the Container

Start the Container
docker compose up -d