containrrr / watchtower

A process for automating Docker container base image updates.
https://containrrr.dev/watchtower/
Apache License 2.0
19.6k stars 864 forks source link

Multiple watchtower instances stopped with remote host #1860

Open TheRolfFR opened 11 months ago

TheRolfFR commented 11 months ago

Describe the bug

Hello there,

I have two instances of Watchtower running on the same host. One is for my docker host when the other one is for my remote host. Even though they are technically on the same docker host, they do not treat the same host.

I use it as a beginner with no scopes at all (yes I know bad).

So I don't really know if it is a real "bug", but would it be possible to very simply differentiate those without using tons of scopes ? And no I don't want to run watchtower on the host itself (I know it would solve the problem, but that is not the solution)

Steps to reproduce

  1. Have two hosts
  2. Create 1 watchtower container with remote docker host argument
  3. Create 1 watchtower container with local docker socket binding
  4. Check status stopped on local one
  5. Docker logs states that multiple instances detected and stopping itself.

Expected behavior

Verify host between instances and notice that they're different before shutting itself down.

Screenshots

No response

Environment

Your logs

time="2023-11-21T22:42:08Z" level=info msg="Watchtower 1.7.1"
time="2023-11-21T22:42:08Z" level=info msg="Using no notifications"
time="2023-11-21T22:42:08Z" level=info msg="Checking all containers (except explicitly disabled with label)"
time="2023-11-21T22:42:08Z" level=info msg="Scheduling first run: 2023-11-22 01:30:00 +0000 UTC"
time="2023-11-21T22:42:08Z" level=info msg="Note that the first check will be performed in 2 hours, 47 minutes, 51 seconds"
time="2023-11-22T01:30:18Z" level=info msg="Found new portainer/portainer-ce:latest image (ab0607294f5a)"
time="2023-11-22T01:31:53Z" level=info msg="Found new jc21/nginx-proxy-manager:latest image (296092b37bb3)"
time="2023-11-22T01:31:53Z" level=info msg="Stopping /nginx-proxy-manager (b8c7d3113dac) with SIGTERM"
time="2023-11-22T01:32:07Z" level=info msg="Stopping /portainer (9a221a0c39cd) with SIGTERM"
time="2023-11-22T01:32:08Z" level=info msg="Creating /portainer"
time="2023-11-22T01:32:09Z" level=info msg="Creating /nginx-proxy-manager"
time="2023-11-22T01:32:10Z" level=info msg="Removing image 8f5ac037179e"
time="2023-11-22T01:32:11Z" level=info msg="Removing image 08c207a4dd27"
time="2023-11-22T01:32:40Z" level=info msg="Session done" Failed=0 Scanned=5 Updated=2 notify=no
time="2023-11-23T01:30:05Z" level=info msg="Session done" Failed=0 Scanned=6 Updated=0 notify=no
time="2023-11-24T01:30:05Z" level=info msg="Session done" Failed=0 Scanned=6 Updated=0 notify=no
time="2023-11-25T01:30:30Z" level=info msg="Found new louislam/uptime-kuma:1 image (87d038efdc15)"
time="2023-11-25T01:30:31Z" level=info msg="Stopping /uptime-kuma (0ac82401db79) with SIGTERM"
time="2023-11-25T01:30:46Z" level=info msg="Creating /uptime-kuma"
time="2023-11-25T01:30:47Z" level=info msg="Removing image 5bab982b1141"
time="2023-11-25T01:30:51Z" level=info msg="Session done" Failed=0 Scanned=6 Updated=1 notify=no
time="2023-11-25T15:17:25Z" level=info msg="Found multiple running watchtower instances. Cleaning up."
time="2023-11-25T15:17:25Z" level=info msg="Stopping /watchtower (48bf5a59b9e0) with SIGTERM"
time="2023-11-26T14:48:31Z" level=info msg="Found multiple running watchtower instances. Cleaning up."
time="2023-11-26T14:48:31Z" level=info msg="Stopping /watchtower (48bf5a59b9e0) with SIGTERM"

Additional context

No response

TheRolfFR commented 11 months ago

yeah the CI thingy failed

piksel commented 11 months ago

You can simply add a (unique) scope label to each of the watchtower instances. To be clear, don't add the --scope argument, just the label. This will prevent the watchtower instances from trying to close each other.