docker-compose.yml
services:
clash:
# ghcr.io/dreamacro/clash
# ghcr.io/dreamacro/clash-premium
# dreamacro/clash
# dreamacro/clash-premium
image: dreamacro/clash-premium
container_name: clash
volumes:
- ./config.yaml:/root/.config/clash/config.yaml
- ./profiles:/root/.config/clash/profiles
- ./ui:/ui # dashboard volume
ports:
- "7890:7890"
- "1081:1081"
- "9090:9090" # external controller (Restful API)
# TUN
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
restart: unless-stopped
network_mode: "bridge" # or "host" on Linux
config.yaml
port: 7890
socks-port: 1081
allow-lan: true
mode: rule
log-level: info
ipv6: true
# external-controller 也可以为 0.0.0.0:9090
# 参考 https://github.com/Dreamacro/clash/wiki/Configuration
external-controller: 0.0.0.0:9090
external-ui: /ui
tun:
enable: true
stack: system
auto-detect-interface: true
...