×

watchtower自动更新容器镜像及自定义更新频率

Falcon 2024-04-30 views:
摘要

正在生成中……

修改更新频率

默认检查更新的频率是24小时,可以使用环境变量 WATCHTOWER_SCHEDULE WATCHTOWER_POLL_INTERVAL 改变其检查频率。

WATCHTOWER_SCHEDULE

遵循 crontab 语法

version: "3"
services:
  watchtower:
    image: containrrr/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      WATCHTOWER_SCHEDULE: "0 0 4 * * *"
      TZ: America/New_York

WATCHTOWER_POLL_INTERVAL

间隔时间,秒数。

version: "3"
services:
  watchtower:
    image: containrrr/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      WATCHTOWER_POLL_INTERVAL: 21600

指定只更新特定容器

使用 commnd 提供容器名,如

version: '3.3'
services:
  watchtower:
    image: containrrr/watchtower
    container_name: watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: container_to_watch1 container_to_watch2
    restart: unless-stopped

本文收录于