docker升级实时通知,你一定要学会的容器升级技巧
前言
大家好,这里是可爱的Cherry。
今天为大家带来一款专注于docker镜像更新通知的工具——diun
该项目定时对比已生成容器的镜像版本与hub.docker上的镜像版本,当有镜像版本更新时,可以通过Ampq、Discord、Gotify、邮件、Matrix、MQTT、Ntfy、Pushover、Rocket.chat、Script、Slack、Teams、TG、Webhook等方式进行通知。
项目地址:https://github.com/crazy-max/diun
项目特征:
允许监视 Docker 存储库并报告新标签
包含和排除带有标签正则表达式的过滤器
通过 go 例程实现内部 cron
用于并行化分析的工作线程池
允许覆盖映像操作系统和体系结构
提供 Docker、Kubernetes、Swarm、Nomad、Dockerfile 和文件提供程序
通过 Gotify、Mail、Slack、Telegram 等获得通知
运行状况检查支持以监控 Diun 观察程序
增强的日志记录
官方 Docker 镜像可用
系统效果
🔻演示通过gotify发送的镜像升级更新通知,别的平台也类似,就不单独部署了。

系统部署
一、docker-compose文件
🔻新建docker-compose.yaml文件,把下面的代码复制进去并修改。
version: "3.5"
services:
diun:
image: crazymax/diun:latest
command: serve
volumes:
- "./diun_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"
restart: always
gotify:
image: gotify/server
ports:
- 56780:80 #gotify的端口号,与下面的diun.yaml要对应上
environment:
- "TZ=Asia/Shanghai"
volumes:
- "./gotify_data:/app/data"

🔻在finalshell中打开diun.yml文件,把下面的代码复制进去并修改。
watch:
workers: 10
schedule: "0 /6 "
jitter: 30s
runOnStartup: true
firstCheckNotif: false
providers:
docker:
watchByDefault: true
watchStopped: true #包括已停止的容器
notif:
gotify:
endpoint: http://192.168.0.126:56780 #gotify的url地址
token: Token123456 #gotify的口令
priority: 1
timeout: 10s
templateTitle: "{{ .Entry.Image }} released"
templateBody: |
Docker tag {{ .Entry.Image }} which you subscribed to through {{ .Entry.Provider }} provider has been released.

二、SSH部署
#来到文件夹
cd /volume1/docker/{item}
#启动容器
docker-compose up -d
三、群晖部署compose
打开container manager,选择项目,点击新建,选择penpot路径,点击下一步即可

四、威联通部署compose
打开container station,创建应用程序,复制代码验证后部署即可

五、gotify配置口令
🔻登录gotify(http://NASip:端口),默认账号密码admin/admin

🔻为diun生成一个通知口令notice的APP

🔻返回后,点小眼睛,获取口令明文

🔻修改到diun.yml文件中,然后重启容器就可以了。

六、gotify手机端部署
🔻这里输入gotify的地址http://192.168.0.126:56780,外网的话自己填写

🔻这里输入刚才新建的app名称,如notice

#本项目为docker部署,所有NAS均可安装#

欢迎朋友们评论区讨论留言。我会定期更新关注NAS使用方法、开源软件与Docker软件、游戏与生活相关内容,喜欢的朋友请关注、点赞、留言支持。
作者声明本文无利益相关,欢迎值友理性交流,和谐讨论~

geniusliang
校验提示文案
geniusliang
diun: error: unexpected argument serve或者
diun: error: unexpected argument server
校验提示文案
YBLoveCX
校验提示文案
夜影小窝
校验提示文案
YBLoveCX
校验提示文案
夜影小窝
校验提示文案
geniusliang
diun: error: unexpected argument serve或者
diun: error: unexpected argument server
校验提示文案
geniusliang
校验提示文案