add Watchtower

master
meftimes 2025-01-03 20:22:26 -05:00
parent 250d6e2037
commit b4c4a2e898
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,14 @@
#test updates in watchtower with ntfy notification
docker stop nginx
# list previous nginx images then pipe them into removal
docker image ls --filter='reference=nginx:*' -q | xargs docker rmi -f
# remove dangling layers, avoid "already exists messages"
docker image prune
# pull old version
docker pull nginx:1.26
# tag that mofo
docker image tag nginx:1.26 nginx:1
# important: run the container
docker run --rm --detach --name nginx nginx:1
# watchtower run once and notify
docker run --rm --net proxy --name watchtower2 -v /var/run/docker.sock:/var/run/docker.sock -e WATCHTOWER_CLEANUP=false -e TZ=America/New_York -e WATCHTOWER_NOTIFICATION_SKIP_TITLE=True -e WATCHTOWER_NOTIFICATION_URL="ntfy://:token_goes_here@ntfy.meftimes.com/alerts?title=Watchtower&priority=high" containrrr/watchtower --debug --run-once nginx

View File

@ -0,0 +1,23 @@
services:
watchtower:
image: containrrr/watchtower
container_name: watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --debug
environment:
WATCHTOWER_SCHEDULE: "0 0 9 * * 0"
WATCHTOWER_CLEANUP: false
WATCHTOWER_DISABLE_CONTAINERS: "gitea postgres"
TZ: "America/New_York"
WATCHTOWER_NO_STARTUP_MESSAGE: true
WATCHTOWER_TIMEOUT: 30s
WATCHTOWER_NOTIFICATION_SKIP_TITLE: true
WATCHTOWER_NOTIFICATION_URL: "ntfy://:token_goes_here@ntfy.meftimes.com/alerts?title=Watchtower&priority=high"
networks:
- proxy
restart: unless-stopped
networks:
proxy:
external: true