설치
"docker-compose.yml" 파일을 아래와 같이 생성 합니다.
version: "3"
services:
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
TZ: Asia/Seoul
WATCHTOWER_POLL_INTERVAL: 43200
WATCHTOWER_CLEANUP: "true" # Enable cleanup of old images
restart: unless-stopped
"WATCHTOWER_POLL_INTERVAL"은 watchtower가 실행될 주기를 의미합니다.
단위는 Second (초)이며, 예제에 있는 43200은 12시간을 의미 합니다.
docker를 실행 합니다.
docker-compose up -d
이후 Watchtower Container의 Log를 보시면 아래와 같이 주어진 주기마다 Scan 및 Update를 진행한 이력을 확인하실 수 있습니다.
date | stream | content |
---|---|---|
2023/06/24 09:53:01 | stderr | time="2023-06-24T09:53:01+09:00" level=info msg="Session done" Failed=0 Scanned=9 Updated=0 notify=no |
2023/06/23 09:53:01 | stderr | time="2023-06-23T09:53:01+09:00" level=info msg="Session done" Failed=0 Scanned=9 Updated=0 notify=no |
2023/06/22 09:53:25 | stderr | time="2023-06-22T09:53:25+09:00" level=info msg="Session done" Failed=0 Scanned=9 Updated=1 notify=no |
2023/06/22 09:53:24 | stderr | time="2023-06-22T09:53:24+09:00" level=info msg="Creating /nextcloud" |
2023/06/22 09:53:19 | stderr | time="2023-06-22T09:53:19+09:00" level=info msg="Stopping /nextcloud (786e591f6e53) with SIGTERM" |
2023/06/22 09:53:12 | stderr | time="2023-06-22T09:53:12+09:00" level=info msg="Found new lscr.io/linuxserver/nextcloud:latest image (3321996051d7)" |
2023/06/21 09:52:45 | stderr | time="2023-06-21T09:52:45+09:00" level=info msg="Note that the first check will be performed in 23 hours, 59 minutes, 59 seconds" |
2023/06/21 09:52:45 | stderr | time="2023-06-21T09:52:45+09:00" level=info msg="Scheduling first run: 2023-06-22 09:52:45 +0900 KST" |
2023/06/21 09:52:45 | stderr | time="2023-06-21T09:52:45+09:00" level=info msg="Checking all containers (except explicitly disabled with label)" |
2023/06/21 09:52:45 | stderr | time="2023-06-21T09:52:45+09:00" level=info msg="Using no notifications" |
2023/06/21 09:52:45 | stderr | time="2023-06-21T09:52:45+09:00" level=info msg="Watchtower 1.5.3" |
2023/06/21 09:41:05 | stderr | time="2023-06-21T09:41:05+09:00" level=info msg="Waiting for running update to be finished..." |