启动容器
运行下面的脚本启动容器
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| #!/usr/bin/env bash
__main() { { _image1="ghcr.io/lwmacct/250210-cr-mihomo:v1.19.3-t2503220" _image2="$(docker images -q $_image1)" if [[ "$_image2" == "" ]]; then docker pull $_image1 _image2="$(docker images -q $_image1)" fi }
_apps_name="service-mihomo" _apps_data="/data/$_apps_name" cat <<EOF | docker compose -p "$_apps_name" -f - up -d --remove-orphans services: main: container_name: $_apps_name image: "$_image2" restart: always privileged: true network_mode: host volumes: - $_apps_data:/apps/data environment: - TZ=Asia/Shanghai EOF } __main
|
编写配置
进入容器内部,访问config.yaml配置文件,根据下面提供的配置按需修改
注意,下面的配置启用了TUN模式,并且仅代理github相关的域名,如果你需要代理其他域名,请根据实际情况修改规则。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| port: 7890 socks-port: 7891 mixed-port: 7892 allow-lan: true mode: rule log-level: info external-controller: 0.0.0.0:9090 secret: "123456"
dns: enable: true ipv6: false listen: 0.0.0.0:1053 enhanced-mode: fake-ip nameserver: - 119.29.29.29 - 223.5.5.5
tun: enable: true stack: system auto-route: true auto-detect-interface: true
proxies: - name: "美国US01节点" server: <你的节点IP/域名> port: <你的节点端口> type: <你的节点类型> cipher: <你的节点加密方式> password: "<你的节点密码>" udp: true
proxy-groups: - name: "🚀 代理选择" type: select proxies: - "美国US01节点" - DIRECT
rules: - DOMAIN-KEYWORD,github,🚀 代理选择 - DOMAIN-SUFFIX,github.com,🚀 代理选择 - DOMAIN-SUFFIX,githubassets.com,🚀 代理选择 - DOMAIN-SUFFIX,githubusercontent.com,🚀 代理选择 - DOMAIN-SUFFIX,gist.github.com,🚀 代理选择 - GEOIP,CN,DIRECT - MATCH,DIRECT
|