Skip to main content
  1. Posts/
  2. Self-Hosting/

Diun - notifications about Docker image updates

··991 words·5 mins· loading · loading · ·
Stilicho2011
Author
Stilicho2011
Writing about homelab, self-hosting, automation and open-source solutions
Table of Contents
Self-Hosting - This article is part of a series.
Part : This Article

Diun - notifications about Docker image updates
#

What is Diun
#

Diun (Docker Image Update Notifier) is an open-source tool developed by CrazyMax that watches for Docker image updates and notifies you when a new version comes out.

Diun doesn’t update containers automatically - it only tells you that a new version of an image is available, leaving the decision up to you. This is especially important if you want to control the update process and avoid unexpected changes in production.

This is a significant difference from an app like Watchtower, which not only checks for a new version but also installs it right away.

DIUN is the recommended container monitoring app according to linuxserver.io


Why you need Diun
#

If you have a home server, a Proxmox cluster, or just a few containers on a VPS, images become outdated over time. Checking for updates manually is inconvenient.

Diun solves this automatically:

  • Checks Docker Hub, GHCR, Quay.io, GitLab, and private registries
  • Runs on a cron schedule or at startup
  • Sends notifications through dozens of services
  • Supports filters and tags
  • Can track containers, compose files, stacks, or registry lists

Installing Diun via Docker Compose
#

Create a directory and a docker-compose.yml file.

Below is the docker compose file I used in the video.

services:
    diun:  # Определяем сервис Diun в составе Docker Compose
        image: crazymax/diun:latest  # Официальный образ Diun с Docker Hub
        container_name: diun         # Имя контейнера (для удобства в `docker ps`)
        command: serve               # Основная команда - запустить веб/cron-сервис Diun
        volumes:
            - "/path/to/user/directory/data:/data"  # Локальный каталог для хранения базы данных и конфигурации Diun
            - "/var/run/docker.sock:/var/run/docker.sock"  # Доступ к Docker API для отслеживания образов и контейнеров
        environment:
            - "TZ=Europe/Moscow"  # Устанавливаем часовой пояс (важно для cron и временных меток)
            - "LOG_LEVEL=info"    # Уровень логирования: trace | debug | info | warn | error | fatal | panic
            - "DIUN_WATCH_WORKERS=50"  # Количество параллельных потоков при проверке образов (ускоряет работу при множестве контейнеров)
            - "DIUN_WATCH_SCHEDULE=0 */6 * * *"  # Cron-расписание: проверять обновления каждые 6 часов
            - "DIUN_WATCH_JITTER=30s"  # Добавляет случайную задержку (до 30 секунд), чтобы избежать одновременного старта нескольких задач
            - "DIUN_WATCH_RUNONSTARTUP=true"  # Запуск проверки сразу при старте контейнера, не дожидаясь расписания
            - "DIUN_PROVIDERS_DOCKER=true"  # Активирует провайдер Docker: Diun будет отслеживать образы запущенных контейнеров
            - "DIUN_PROVIDERS_DOCKER_WATCHBYDEFAULT=true"  # Включает мониторинг всех контейнеров по умолчанию, без необходимости вручную задавать label `diun.enable=true`

            # --- Настройки уведомлений через Telegram ---
            - "DIUN_NOTIF_TELEGRAM_TOKEN=token"  # Токен Telegram-бота, созданного через @BotFather
            - "DIUN_NOTIF_TELEGRAM_CHATIDS=chatid"  # ID чата или пользователя, куда будут отправляться уведомления (можно указать несколько через запятую)

            # --- Настройки уведомлений через Gotify ---
            - "DIUN_NOTIF_GOTIFY_ENDPOINT=https://gotify.domain.ru"  # URL вашего сервера Gotify
            - "DIUN_NOTIF_GOTIFY_TOKEN=token"  # Токен приложения Gotify (создаётся в веб-интерфейсе Gotify)
            - "DIUN_NOTIF_GOTIFY_PRIORITY=1"  # Приоритет уведомления (0 - низкий, 5 - высокий)
            - "DIUN_NOTIF_GOTIFY_TIMEOUT=10s"  # Таймаут ожидания ответа от Gotify при отправке уведомления

        labels:
            - "diun.enable=true"  # Метка, разрешающая Diun отслеживать этот контейнер (опционально, если `WATCHBYDEFAULT=false`)
        restart: always  # Перезапуск контейнера при сбое или перезагрузке Docker-хоста

After the first launch, Diun will create the data/diun.db database and start monitoring all Docker containers. You can see more details in the app’s logs.

Diun is highly configurable. Below is a brief overview of the most useful features.

Operating modes
#

  • Watch - Diun periodically scans all containers to check for updates.
  • Events - reacts to a container starting and checks whether a newer image is available.
  • Database mode - stores the state of all checked images so it doesn’t send duplicate notifications.

Container labels
#

You can specify which containers to track. Add this to docker-compose.yml:

labels:
  - "diun.enable=true" 

or, conversely, exclude containers you don’t need.

Providers
#

Diun supports different sources:

  • docker - works with the local Docker daemon
  • swarm - tracks images in Docker Swarm
  • file - a list of images in a YAML file
  • kubernetes - (experimental) checks images in pods
  • watchtower - imports configuration from Watchtower

Example of a YAML provider:

db:
  path: diun.db

watch:
  workers: 20
  schedule: "0 */6 * * *"

regopts:
  - name: "myregistry"
    username: fii
    password: bor
    timeout: 5s
  - name: "docker.io/crazymax"
    selector: image
    username: fii
    password: bor
  - name: "docker.io"
    selector: image
    username: foo
    password: bar

providers:
  file:
    filename: /path/to/config.yml
### /path/to/config.yml

# Watch latest tag of crazymax/nextcloud image on docker.io (DockerHub)
# with registry options named 'docker.io/crazymax' (image selector).
- name: docker.io/crazymax/nextcloud:latest

# Watch 4.0.0 tag of jfrog/artifactory-oss image on frog-docker-reg2.bintray.io (Bintray)
# with registry options named 'myregistry' (name selector).
- name: jfrog-docker-reg2.bintray.io/jfrog/artifactory-oss:4.0.0
  regopt: myregistry

# Watch coreos/hyperkube image on quay.io (Quay) and assume latest tag.
# Add foo=bar metadata to be used in notification template.
- name: quay.io/coreos/hyperkube
  metadata:
    foo: bar

# Watch crazymax/swarm-cronjob image and assume docker.io registry and latest tag
# with registry options named 'docker.io/crazymax' (image selector).
# Only include tags matching regexp ^1\.2\..* and only be notified on new tag.
- name: crazymax/swarm-cronjob
  watch_repo: true
  notify_on:
    - new
  include_tags:
    - ^1\.2\..*

# Watch portainer/portainer image on docker.io (DockerHub) and assume latest tag
# with registry options named 'docker.io' (image selector).
# Only watch latest 10 tags and include tags matching regexp ^\d+\.\d+\..*
- name: docker.io/portainer/portainer
  watch_repo: true
  max_tags: 10
  include_tags:
    - ^\d+\.\d+\..*

# Watch alpine image (library) and assume docker.io registry and latest tag
# with registry options named 'docker.io' (image selector).
# Force linux/arm64/v8 platform for this image
- name: alpine
  watch_repo: true
  platform:
    os: linux
    arch: arm64
    variant: v8

You can read more in the official documentation

Notifications
#

Diun can send notifications to more than 15 services:

ServiceEnvironment variables
TelegramDIUN_NOTIF_TELEGRAM_TOKEN, DIUN_NOTIF_TELEGRAM_CHATIDS
DiscordDIUN_NOTIF_DISCORD_WEBHOOKURL
GotifyDIUN_NOTIF_GOTIFY_ENDPOINT, DIUN_NOTIF_GOTIFY_TOKEN
SlackDIUN_NOTIF_SLACK_WEBHOOKURL
EmailDIUN_NOTIF_MAIL_SMTP_HOST, DIUN_NOTIF_MAIL_FROM, DIUN_NOTIF_MAIL_TO
WebhookDIUN_NOTIF_WEBHOOK_ENDPOINT

You can use several notification services at once, as I did in my docker compose file.

Conclusion
#

Diun is a must-have tool for anyone running Docker in a self-hosted infrastructure.
It’s lightweight, stable, requires no complex setup, and pairs nicely with other DevOps services.

If you want to keep your infrastructure up to date, Diun will help you learn about updates in time and avoid surprises.

Self-Hosting - This article is part of a series.
Part : This Article

Related