What is DIUN?
Docker Image Update Notifier
is an applicationGo
writtenCLI
in that can be delivered as a single executable andDocker
an image to receive notifications whenDocker
the image is updatedDocker registry
in .
watchtower
Different from what Lao Su introduced before , DIUN
it is just a notification, and will not automatically update mirrors and containers watchtower
like
Article portal: watchtower automatically updates the docker image
Prepare
Originally, Lao Su planned to use 88
email , but it was either 554 sender is rejected
a mistake
diun | Wed, 24 May 2023 17:17:56 CST ERR Mail notification failed error="gomail: could not send email 1: 554 sender is rejected: 0" image=docker.io/crazymax/diun:latest
Either it is error=EOF
a mistake , I am too lazy to change the mailbox
diun | Wed, 24 May 2023 19:14:06 CST ERR Mail notification failed error=EOF image=docker.io/crazymax/diun:latest
DIUN
It also supports many message types, and Lao Su finally chose to useGotify
Get Gotify Token
If you still don’t understand or have not installed it Gotify
, you can click the portal below
Article portal: Gotify message push system construction
After the installation is complete, create a new application and obtain it Token
, which we will use to push messages later
Configuration file diun.yml
Diun
There are two different ways to define configuration in
- use environment variables
- use configuration file
Lao Su adopted the configuration file method, and the specific parameters can be found in the official description: https://crazymax.dev/diun/config/
Here we profile all running containers of a local instance 6
hourly with a minimal configuration and send messages usingDocker
gotify
db:
path: diun.db
watch:
workers: 10
schedule: "0 */6 * * *"
firstCheckNotif: true
notif:
gotify:
endpoint: http://192.168.0.197:8385
token: <你的 Gotify Token >
priority: 1
timeout: 10s
templateTitle: "{
{ .Entry.Image }} released"
templateBody: |
Docker tag {
{ .Entry.Image }} which you subscribed to through {
{ .Entry.Provider }} provider has been released.
providers:
docker:
watchStopped: true
watchByDefault: true
There are two things to modify above
endpoint
: Replace it with your owngotify
access address;token
: Also replace it with the one yougotify
gotToken
;
Install
All container-related applications need to be bound and mounted , including , , , , etc. /var/run/docker.sock
that we installed before .portainer
watchtower
Glances
Netdata
lazydocker
what /var/run/docker.sock
is
/var/run/docker.sock
is the main entry pointDocker API
of , simply put, it is the domain socket ( ) thatDocker
the daemon process ( )Docker daemon
listens to by default , and the process in the container can communicate with the daemon .Unix
Unix domain socket
Docker
Image from: https://betterprogramming.pub/about-var-run-docker-sock-3bfd276e12fd
But Synology's Docker
manager does not support mounting /var/run/docker.sock
files, so this time we need to use the command line to install
docker cli install
If you are familiar with the command line, it may be docker cli
faster
# 新建文件夹 diun 和 子目录
mkdir -p /volume2/docker/diun/data
# 进入 diun 目录
cd /volume2/docker/diun
# 将 diun.yml 放入当前目录
# 运行容器
docker run -d \
--restart always \
--name diun \
-v $(pwd)/data:/data \
-v $(pwd)/diun.yml:/diun.yml:ro \
-v /var/run/docker.sock:/var/run/docker.sock \
-e "TZ=Asia/Shanghai" \
-e "LOG_LEVEL=info" \
-e "LOG_JSON=false" \
crazymax/diun:latest \
serve
docker-compose install
Save the following content as docker-compose.yml
a file
version: "3.5"
services:
diun:
image: crazymax/diun:latest
container_name: diun
restart: always
volumes:
- "./data:/data"
- "./diun.yml:/diun.yml:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
- "TZ=Asia/Shanghai"
- "LOG_LEVEL=info"
- "LOG_JSON=false"
command: serve
Then execute the following command
# 新建文件夹 diun 和 子目录
mkdir -p /volume2/docker/diun/data
# 进入 diun 目录
cd /volume2/docker/diun
# 将 diun.yml 和 docker-compose.yml 放入当前目录
# 一键启动
docker-compose up -d
run
Enter in the browser http://群晖IP:8385
to view Gotify
the message , when a new version of the container is detected, the message will be received
reference documents
crazy-max/diun: Receive notifications when an image is updated on a Docker registry
地址:https://github.com/crazy-max/diun/
Diun document
address: https://crazymax.dev/diun/
alerting system for the publishing of new docker images with DIUN: how have you configurated it for emails message? Have you some examples to optimize mine? I have got a couple of questions… : selfhosted
地址:https://www.reddit.com/r/selfhosted/comments/qbunu2/alerting_system_for_the_publishing_of_new_docker/