Files
ChatRoom/docker-compose.watchtower.yml
2026-02-03 23:45:27 +08:00

22 lines
778 B
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 配合 Watchtower 实现自动拉取镜像并重新部署
# 用法: docker compose -f docker-compose.yml -f docker-compose.watchtower.yml up -d
#
# 推送新镜像后Watchtower 会检测到更新并自动重启 chatroom-app 容器
services:
watchtower:
image: containrrr/watchtower
container_name: chatroom-watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
# 每 5 分钟检查一次镜像更新
- WATCHTOWER_POLL_INTERVAL=300
# 只监控带 com.centurylinklabs.watchtower.enable=true 标签的容器
- WATCHTOWER_LABEL_ENABLE=true
# 清理旧镜像
- WATCHTOWER_CLEANUP=true
# 仅当使用远程镜像时启用,本地构建请注释掉此服务
profiles:
- watchtower