Skip to content

Setting Up Watchtower with Docker Compose

Introduction to Watchtower

Watchtower is an application that automatically updates your running Docker containers to the latest images. It monitors all containers and updates them in real-time whenever a new image is released.

Docker Compose Configuration for Watchtower

This Docker Compose setup deploys Watchtower in a Docker container, ensuring your other containers are always up-to-date with the least amount of hassle.

Docker Compose File (docker-compose.yml)

version: '3'
    image: containrrr/watchtower
      - --cleanup=true
    restart: always
      - /var/run/docker.sock:/var/run/docker.sock

Key Components of the Configuration


  • containrrr/watchtower: The Docker image used for Watchtower.


  • --cleanup=true: Enables cleanup of old images after updating.

Restart Policy

  • always: Ensures the Watchtower container restarts automatically after a crash or reboot.


  • /var/run/docker.sock:/var/run/docker.sock: Mounts the Docker socket so Watchtower can interact with the Docker daemon.

Deploying Watchtower

  1. Save the Docker Compose configuration in a docker-compose.yml file.
  2. Run docker-compose up -d to start Watchtower in detached mode.

How Watchtower Works

Once deployed, Watchtower automatically checks for updates to the images of all running containers at the specified interval. If a new image is found, Watchtower updates the container without downtime.

Remember to ensure that your containers are configured to handle updates gracefully!

Youtube Video