docker 容器安装配置 headscale
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
curl -L --create-dirs -o ./etc/headscale/config/config.yml https://raw.githubusercontent.com/juanfont/headscale/refs/heads/main/config-example.yaml
修改 config.yml
配置项 | 位置 | 默认值 | 新值 |
server_url | 13 行 | http://127.0.0.1:8080 | https://java-jar.fun:1180 |
listen_addr | 19 行 | 127.0.0.1:8080 | 0.0.0.0:1180 |
metrics_listen_addr | 25 行 | 127.0.0.1:9090 | 0.0.0.0:1181 |
tls_cert_path | 220 行 | "" | "/etc/uhttpd.crt" |
tls_key_path | 221 行 | "" | "/etc/uhttpd.key" |
dns.nameservers.global(274 行) 下面第一行加一项:114.114.114.114
启动 compose
docker compose up -d
配置命令别名
echo 'alias headscale="docker exec -it headscale headscale"' >> /etc/profile
source /etc/profile