docker 容器安裝配置 headscale

Nihaorz發表於2024-10-09

docker-compose.yml

services:

  headscale:
    image: headscale/headscale:v0.23.0
    container_name: headscale
    volumes:
      - /etc/uhttpd.crt:/etc/uhttpd.crt
      - /etc/uhttpd.key:/etc/uhttpd.key
      - ./etc/headscale/config:/etc/headscale
      - ./etc/headscale/data:/var/lib/headscale
    environment:
      - TZ=Asia/Shanghai
    entrypoint: headscale serve
    restart: unless-stopped
    network_mode: host

建立 config.yml

mkdir -p ./etc/headscale/config
curl -L -o ./etc/headscale/config/config.yml https://raw.githubusercontent.com/juanfont/headscale/refs/heads/main/config-example.yaml

修改 config.yml

配置項 預設值 新值
server_url http://127.0.0.1:8080 https://java-jar.fun:1180
listen_addr 127.0.0.1:8080 0.0.0.0:1180
metrics_listen_addr 127.0.0.1:9090 0.0.0.0:1181
tls_cert_path "" "/etc/uhttpd.crt"
tls_key_path "" "/etc/uhttpd.key"

dns.nameservers.global 下面第一行加一項:114.114.114.114

啟動 compose

docker compose up -d

相關文章