- healthcheck 改 exec 形式(distroless 映像無 /bin/sh,CMD-SHELL 永遠 unhealthy) - 補 command: serve、對外開 3478/udp(DERP STUN) - config.yaml 內建 DERP 設為 enabled(region tw),與線上實跑一致 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
1003 B
YAML
51 lines
1003 B
YAML
services:
|
|
headscale:
|
|
image: headscale/headscale:v0.29.0
|
|
container_name: headscale
|
|
command: serve
|
|
restart: unless-stopped
|
|
networks:
|
|
- shared-net
|
|
|
|
# 環境變數
|
|
environment:
|
|
- TZ=Asia/Taipei
|
|
|
|
# 健康檢查
|
|
healthcheck:
|
|
test: ["CMD", "headscale", "version"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# 日誌配置
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
# 卷掛載
|
|
volumes:
|
|
- ./config:/etc/headscale:ro
|
|
- ./data:/var/lib/headscale
|
|
- /etc/localtime:/etc/localtime:ro
|
|
|
|
# 埠位映射
|
|
ports:
|
|
- "8080:8080" # HTTP API
|
|
- "9090:9090" # Metrics
|
|
- "50443:50443" # gRPC
|
|
- "3478:3478/udp" # DERP STUN
|
|
|
|
# 標籤配置
|
|
labels:
|
|
- "com.centurylinklabs.watchtower.enable=true"
|
|
- "description=Headscale WireGuard control plane"
|
|
|
|
networks:
|
|
shared-net:
|
|
external: true
|
|
|