Skip to content
Running Multiple Instances

Running Multiple Instances

By default, Watchtower will clean up other instances within the same scope and won’t allow multiple instances running on the same Docker host or swarm. It is possible to override this behavior by defining a scope to each running instance.

  • Multiple instances can’t run with the same scope.
  • An instance without a scope will only clean up other unscoped running instances, allowing coexistence with scoped instances.
  • Supplying none as the scope will treat com.centurylinklabs.watchtower.scope=none, com.centurylinklabs.watchtower.scope= and the lack of a com.centurylinklabs.watchtower.scope label as the scope none. This enables you to run both scoped and unscoped watchtower instances on the same machine.

To define an instance monitoring scope, use the --scope argument or the WATCHTOWER_SCOPE environment variable on startup and set the com.centurylinklabs.watchtower.scope label with the same value for the containers you want to include in this instance’s scope (including the instance itself).

For example, in a Docker Compose config file:

services:
    app-with-scope:
        image: myapps/monitored-by-watchtower
        labels: [ "com.centurylinklabs.watchtower.scope=myscope" ]

    scoped-watchtower:
        image: nickfedor/watchtower
        volumes: [ "/var/run/docker.sock:/var/run/docker.sock" ]
        command: --interval 30 --scope myscope
        labels: [ "com.centurylinklabs.watchtower.scope=myscope" ]

    unscoped-app-a:
        image: myapps/app-a

    unscoped-app-b:
        image: myapps/app-b
        labels: [ "com.centurylinklabs.watchtower.scope=none" ]

    unscoped-app-c:
        image: myapps/app-b
        labels: [ "com.centurylinklabs.watchtower.scope=" ]

    unscoped-watchtower:
        image: nickfedor/watchtower
        volumes: [ "/var/run/docker.sock:/var/run/docker.sock" ]
        command: --interval 30 --scope none
Last updated on