crazy-max / diun

Receive notifications when an image is updated on a Docker registry
https://crazymax.dev/diun/
MIT License
2.91k stars 111 forks source link

Error "No such image" for some images on Swarm #350

Closed sadmin91 closed 3 years ago

sadmin91 commented 3 years ago

Behaviour

I have installed Diun on my Docker Swarm cluster. With the last version (4.15.2), when Diun analyze start (on container startup or on schedule), error "No such image" appears for some images on my Swarm services (no error with image on my file provider).

Steps to reproduce this issue

1.Deploy Diun on Swarm cluster

Expected behaviour

No error should appears

Actual behaviour

Error during Diun analyze.

Configuration

watch: workers: 5 schedule: "0 0 *" firstCheckNotif: false

notif: mail: host: xxx port: xxx ssl: true insecureSkipVerify: false username: xxx password: xxx from: xxx to: xxx

providers: swarm: apiVersion: "1.39" watchByDefault: false file: filename: /fileProvider.yml

* Diun File Provider:

Logs

See debug log content:

Thu, 29 Apr 2021 13:43:43 CEST INF Starting Diun version=4.15.2
Thu, 29 Apr 2021 13:43:43 CEST INF Configuration loaded from file: /diun.yml
Thu, 29 Apr 2021 13:43:43 CEST INF Configuration loaded from 1 environment variable(s)
Thu, 29 Apr 2021 13:43:43 CEST DBG {
  "db": {
    "path": "/data/diun.db"
  },
  "watch": {
    "workers": 5,
    "schedule": "0 0 * * *",
    "firstCheckNotif": false,
    "compareDigest": true
  },
  "notif": {
    "mail": {
      "host": "xxx",
      "port": xxx,
      "ssl": true,
      "insecureSkipVerify": false,
      "localName": "localhost",
      "username": "xxx",
      "password": "xxx",
      "from": "xxx",
      "to": "xxx"
    }
  },
  "providers": {
    "swarm": {
      "apiVersion": "1.39",
      "tlsVerify": true,
      "watchByDefault": false
    },
    "file": {
      "filename": "/fileProvider.yml"
    }
  }
}
Thu, 29 Apr 2021 13:43:43 CEST DBG 1 notifier(s) created
Thu, 29 Apr 2021 13:43:43 CEST DBG 20 entries found in manifest bucket
Thu, 29 Apr 2021 13:43:43 CEST DBG Current database version: 2
Thu, 29 Apr 2021 13:43:43 CEST INF Cron triggered
Thu, 29 Apr 2021 13:43:43 CEST ERR Cannot inspect image error="Error: No such image: willfarrell/autoheal:latest@sha256:c4f83d20651d427a86d31c4584338a7d59528a61e54b9461874717333a11b4b3" ctn_image=willfarrell/autoheal:latest@sha256:c4f83d20651d427a86d31c4584338a7d59528a61e54b9461874717333a11b4b3 provider=swarm svc_name=autoheal
Thu, 29 Apr 2021 13:43:43 CEST ERR Cannot inspect image error="Error: No such image: bitwardenrs/server:latest@sha256:29a6be94a187198eef4a4bbe3bbd0ca1568c0cc9d460721e63f213a731de9f06" ctn_image=bitwardenrs/server:latest@sha256:29a6be94a187198eef4a4bbe3bbd0ca1568c0cc9d460721e63f213a731de9f06 provider=swarm svc_name=bitwarden
crazy-max commented 3 years ago

@sadmin91 I guess Diun can't find the image because it's deployed on the manager and the analyzed containers are on the workers. Will find a better way to handle that. Thanks for your feedback.

sadmin91 commented 3 years ago

Similar issue has been fix on issue #52 Maybe, a similar correction could be done.

crazy-max commented 3 years ago

@sadmin91 Don't think that's the same issue. I've recently updated the Swarm provider to inspect the image and that's wrong actually :sweat_smile:

crazy-max commented 3 years ago

@sadmin91 Should be fixed with latest release

sadmin91 commented 3 years ago

@crazy-max it's works fine with version 4.16.1. Many thanks for this quick fix.