這是本文件的舊版!
使用 watchtower 自動更新 docker images
- 在 docker-compose.yml 內 services: 加入 watchtower: Exp
services: your-app: image: your-image:latest # 其他應用配置... watchtower: container_name: watchtower image: containrrr/watchtower network_mode: host volumes: - /var/run/docker.sock:/var/run/docker.sock environment: - TZ=Asia/Taipei - WATCHTOWER_SCHEDULE=0 0 4 * * * # 每天凌晨4點檢查更新 - WATCHTOWER_CLEANUP=true # 清理舊的映像檔 #- WATCHTOWER_NOTIFICATIONS=slack # 使用 Slack 通知 #- SLACK_HOOK_URL=https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK #- WATCHTOWER_NOTIFICATIONS=email # 使用 EMail 通知 #- WATCHTOWER_NOTIFICATIONS_HOSTNAME=${HOSTNAME} #- [email protected] #- [email protected] #- WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com #- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=587 #- [email protected] #- WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=app_password #- WATCHTOWER_NOTIFICATION_EMAIL_DELAY=2 labels: - "com.centurylinklabs.watchtower.enable=true" restart: unless-stopped