Skip to content

Logotype depicting a lighthouse

Watchtower

A container-based solution for automating Docker container base image updates.

CI Codecov Go Reference Go Report Card Latest release Apache-2.0 License Pulls from DockerHub

Quick start

Watchtower watches the Docker daemon it's pointed at, polls the registries of the running containers' images, and — when a digest changes — gracefully stops each stale container and recreates it with the same config (volumes, networks, env, command).

Pull from either registry; the images are identical:

docker pull openserbia/watchtower          # Docker Hub
docker pull ghcr.io/openserbia/watchtower  # GitHub Container Registry

Run it

docker run --detach \
    --name watchtower \
    --restart unless-stopped \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    openserbia/watchtower \
    --interval 60 --cleanup
services:
  watchtower:
    image: openserbia/watchtower:latest
    container_name: watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command:
      - --interval=60
      - --cleanup
      - --label-enable

That's enough to start: Watchtower polls every 60 s and deletes old images after a successful update.

Scoping what it updates

By default, every container on the host is a candidate. To opt in only a chosen set, pass --label-enable and label the target containers:

docker run -d --label com.centurylinklabs.watchtower.enable=true my-app:latest

Omit the label to keep a container untouched (databases, stateful services, anything with a manual release process).

What's next