Diun 2.0 adds support for Docker and Swarm providers
Tags: docker, registry, notification, go
Published: 2019-12-14 18:02:45

---
title: Diun 2.0 adds support for Docker and Swarm providers
published: true
description: Receive notifications when a Docker image is updated on a Docker registry.
tags: docker,registry,notification,golang
---

{% github crazy-max/diun %}

I just released the new major release 2.0 of Diun and I think this one might interest you.

For those who don't know, [**Diun**](https://github.com/crazy-max/diun) 🔔 is a CLI application written in [Go](https://golang.org/) to receive notifications 📥 when a Docker 🐳 image is updated on a Docker registry.

![Mail notification](https://thepracticaldev.s3.amazonaws.com/i/opw2zewt0b7vcilsx28r.png)

In its first version this one only allowed the analysis of images added manually in the configuration file.

But in this new release, there is the addition of support for [Docker engines provider](https://github.com/crazy-max/diun/blob/master/doc/providers/docker.md) and [Swarm clusters provider](https://github.com/crazy-max/diun/blob/master/doc/providers/swarm.md). I put it in the plural because you can add as many engines as you want. This may allow some sysadmin to centralize notifications when analyzing images.

For these new providers, the analysis can be done on all the containers/services found (even those stopped). The configuration can be global for your provider or more refined by the introduction of [Docker labels dedicated to Diun](https://github.com/crazy-max/diun/blob/master/doc/providers/docker.md#configuration):

```yml
version: "3.5"

services:
  diun:
    image: crazymax/diun:latest
    volumes:
      - "./data:/data"
      - "./diun.yml:/diun.yml:ro"
      - "/var/run/docker.sock:/var/run/docker.sock"
    environment:
      - "TZ=Europe/Paris"
      - "LOG_LEVEL=info"
      - "LOG_JSON=false"
    restart: always

  cloudflared:
    image: crazymax/cloudflared:latest
    ports:
      - target: 5053
        published: 5053
        protocol: udp
      - target: 49312
        published: 49312
        protocol: tcp
    environment:
      - "TZ=Europe/Paris"
      - "TUNNEL_DNS_UPSTREAM=https://1.1.1.1/dns-query,https://1.0.0.1/dns-query"
    labels:
      - "diun.enable=true"
      - "diun.watch_repo=true"
    restart: always
```

Logs will look like:


```
$ docker-compose logs -f
Attaching to bin_diun_1, cloudflared
cloudflared    | time="2019-12-14T15:30:07+01:00" level=info msg="Adding DNS upstream" url="https://1.1.1.1/dns-query"
cloudflared    | time="2019-12-14T15:30:07+01:00" level=info msg="Adding DNS upstream" url="https://1.0.0.1/dns-query"
cloudflared    | time="2019-12-14T15:30:07+01:00" level=info msg="Starting metrics server" addr="[::]:49312"
cloudflared    | time="2019-12-14T15:30:07+01:00" level=info msg="Starting DNS over HTTPS proxy server" addr="dns://0.0.0.0:5053"
diun_1         | Sat, 14 Dec 2019 15:30:07 CET INF Starting Diun v2.0.0
diun_1         | Sat, 14 Dec 2019 15:30:07 CET INF Found 1 docker provider(s) to analyze...
diun_1         | Sat, 14 Dec 2019 15:30:10 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:latest provider=docker
diun_1         | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.9.0 provider=docker
diun_1         | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.9.1 provider=docker
diun_1         | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.9.2 provider=docker
diun_1         | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.10.1 provider=docker
diun_1         | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.10.4 provider=docker
diun_1         | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.10.2 provider=docker
diun_1         | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.11.0 provider=docker
diun_1         | Sat, 14 Dec 2019 15:30:12 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.11.3 provider=docker
diun_1         | Sat, 14 Dec 2019 15:30:13 CET INF New image found id=mydocker image=docker.io/crazymax/cloudflared:2019.11.2 provider=docker
diun_1         | Sat, 14 Dec 2019 15:30:13 CET INF Cron initialized with schedule */30 * * * *
diun_1         | Sat, 14 Dec 2019 15:30:13 CET INF Next run in 29 minutes (2019-12-14 16:00:00 +0100 CET)
```


Let me know if you have any questions or if you are waiting for new features!

---

Support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) 👏 or by making a [Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely! 🚀

Thanks again for your support, it is much appreciated! 🙏