From d42920bfb242e27cad2031c48853c9d18c85f103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= <37316281+yanhao98@users.noreply.github.com> Date: Sun, 3 Nov 2024 22:57:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20watchtower=20=E7=9A=84=20R?= =?UTF-8?q?EADME.md=20=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stacks/watchtower/README.md | 46 ------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 stacks/watchtower/README.md diff --git a/stacks/watchtower/README.md b/stacks/watchtower/README.md deleted file mode 100644 index d275d4e..0000000 --- a/stacks/watchtower/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Watchtower - -```bash -RUN_ONCE=true # 是否只运行一次 -CONTAINER_NAME="" # 如果不设置 container_name,则会监控所有容器 -DOCKER_ARGS=() -WATCHTOWER_ARGS=() -WATCHTOWER_ARGS=(--cleanup) -WATCHTOWER_ARGS=(--remove-volumes) -WATCHTOWER_ARGS=(--rolling-restart) - -if [ "$RUN_ONCE" = true ]; then - WATCHTOWER_ARGS+=(--run-once) - DOCKER_ARGS+=(--rm) -else - WATCHTOWER_ARGS+=(--label-enable) # 仅监控并更新标签为 com.centurylinklabs.watchtower.enable 设置为 true 的容器。 - WATCHTOWER_ARGS+=(--schedule "0 0 3 * * *") # 每天凌晨 3 点执行 - DOCKER_ARGS+=(-d) - DOCKER_ARGS+=(--restart unless-stopped) - DOCKER_ARGS+=(--name watchtower) -fi - -if [ -f ~/.docker/config.json ]; then # 如果 ~/.docker/config.json 存在 - DOCKER_ARGS+=(-v ~/.docker/config.json:/config.json) -fi - -docker run "${DOCKER_ARGS[@]}" \ - -e TZ=Asia/Shanghai \ - -v /var/run/docker.sock:/var/run/docker.sock \ - containrrr/watchtower "${WATCHTOWER_ARGS[@]}" $CONTAINER_NAME -``` - ---- -**邮件通知** - -```bash - -e WATCHTOWER_NOTIFICATIONS=email \ - -e WATCHTOWER_NOTIFICATION_EMAIL_FROM=❗️❗️❗️ \ - -e WATCHTOWER_NOTIFICATION_EMAIL_TO=❗️❗️❗️ \ - -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER=❗️❗️❗️ \ - -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=465 \ - -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=❗️❗️❗️ \ - -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=❗️❗️❗️ \ - -e WATCHTOWER_NOTIFICATION_EMAIL_DELAY=2 \ - -e WATCHTOWER_NOTIFICATIONS_HOSTNAME="$(hostname)" \ -``` \ No newline at end of file