Skip to content

Multiple Instances - Only work if fired in particular order #2113

@paytah232

Description

@paytah232

Describe the bug

Using the follower docker compose information, the scope to allow for multiple instances only works when the none container is started first. If the non-none container is started first, it gets closed down when the none container is started

watchtower:
    image: containrrr/watchtower:latest
    container_name: watchtower
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Australia/Brisbane
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_REMOVE_VOLUMES=false
      - WATCHTOWER_INCLUDE_RESTARTING=true
      - WATCHTOWER_INCLUDE_STOPPED=true
      - WATCHTOWER_SCHEDULE=0 0 3 * * * # Update & Scan containers at 3am
      - WATCHTOWER_LABEL_ENABLE=true
      - WATCHTOWER_SCOPE=none
      - WATCHTOWER_ROLLING_RESTART=true
      - WATCHTOWER_TIMEOUT=60s
      - WATCHTOWER_NOTIFICATION_REPORT=true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "/watchtower", "--health-check"]
      interval: 1m
      timeout: 10s
      retries: 3
      start_period: 10s
    labels:
      - com.centurylinklabs.watchtower.enable=true
      - autoheal=true
    networks:
      - media-network
  watchtower-mousehole:
    image: containrrr/watchtower:latest
    container_name: watchtower-mousehole
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Australia/Brisbane
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_REMOVE_VOLUMES=false
      - WATCHTOWER_INCLUDE_RESTARTING=true
      - WATCHTOWER_INCLUDE_STOPPED=true
      - WATCHTOWER_SCHEDULE=0 0 3 * * * # Update & Scan containers at 3am
      - WATCHTOWER_SCOPE=mousehole
      - WATCHTOWER_ROLLING_RESTART=false
      - WATCHTOWER_TIMEOUT=60s
      - WATCHTOWER_NOTIFICATION_REPORT=true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "/watchtower", "--health-check"]
      interval: 1m
      timeout: 10s
      retries: 3
      start_period: 10s
    labels:
      - com.centurylinklabs.watchtower.enable=true
      - autoheal=true
    networks:
      - media-network
watchtower  | time="2025-07-27T00:04:15+10:00" level=info msg="Found multiple running watchtower instances. Cleaning up."
watchtower  | time="2025-07-27T00:04:15+10:00" level=info msg="Stopping /watchtower-mousehole (11cc8131d5fe) with SIGTERM"
watchtower  | time="2025-07-27T00:04:16+10:00" level=info msg="Removing image e7dd50d07b86"
watchtower  | time="2025-07-27T00:04:16+10:00" level=warning msg="Could not cleanup watchtower images, possibly because of other watchtowers instances in other scopes." error="Error response from daemon: conflict: unable to delete e7dd50d07b86 (cannot be forced) - image is being used by running container d777fe648a9e"
watchtower  | time="2025-07-27T00:04:16+10:00" level=info msg="Watchtower 1.7.1"
watchtower  | time="2025-07-27T00:04:16+10:00" level=info msg="Using no notifications"
watchtower  | time="2025-07-27T00:04:16+10:00" level=info msg="Only checking containers using enable label, without a scope,"
watchtower  | time="2025-07-27T00:04:16+10:00" level=info msg="Scheduling first run: 2025-07-27 03:00:00 +1000 AEST"
watchtower  | time="2025-07-27T00:04:16+10:00" level=info msg="Note that the first check will be performed in 2 hours, 55 minutes, 43 seconds"

Attaching to watchtower-mousehole
watchtower-mousehole  | time="2025-07-27T00:04:31+10:00" level=info msg="Watchtower 1.7.1"
watchtower-mousehole  | time="2025-07-27T00:04:31+10:00" level=info msg="Using no notifications"
watchtower-mousehole  | time="2025-07-27T00:04:31+10:00" level=info msg="Only checking containers in scope \"mousehole\""
watchtower-mousehole  | time="2025-07-27T00:04:31+10:00" level=info msg="Scheduling first run: 2025-07-27 03:00:00 +1000 AEST"
watchtower-mousehole  | time="2025-07-27T00:04:31+10:00" level=info msg="Note that the first check will be performed in 2 hours, 55 minutes, 28 seconds"

Steps to reproduce

  1. Run docker as above, start watchtower-moushole first, then watchtower, it will close.
  2. Run docker as above, start watchtower first, then watchtower-mousehold, it stays open.

Expected behavior

Both container remain running, regardless of the starting order, as both use a unique scope label.

Screenshots

No response

Environment

  • Platform: Linux - Ubuntu
  • Docker Version: 28.3.0

Your logs

As above

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions