FROM alpine:latest
# 安装所需工具
RUN apk add --no-cache curl bash gzip
# 下载并解压 mihomo
WORKDIR /usr/local/bin
RUN curl -L -o mihomo.gz https://github.com/MetaCubeX/mihomo/releases/download/v1.19.8/mihomo-linux-arm64-v1.19.8.gz && \
gunzip mihomo.gz && \
chmod +x mihomo
# 创建配置目录
WORKDIR /etc/mihomo
# 复制启动脚本
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
#!/bin/bash
CONFIG_FILE=${CONFIG_FILE:-/etc/mihomo/config.yaml}
if [ ! -f "$CONFIG_FILE" ]; then
echo "❌ 配置文件 $CONFIG_FILE 不存在,容器退出。"
exit 1
fi
echo "✅ 启动 Mihomo,使用配置文件 $CONFIG_FILE"
nohup /usr/local/bin/mihomo -f "$CONFIG_FILE" > /etc/mihomo/mihomo.log 2>&1 &
tail -f /etc/mihomo/mihomo.log
version: '3.8'
services:
mihomo:
image: koalalove/mihomo:1.19.8
container_name: mihomo
ports:
- "9090:8443"
- "9091:10817"
volumes:
- ./config:/etc/mihomo
- ./cer:/root/.config/mihomo
restart: unless-stopped
listeners:
- name: anytls-in-1
type: anytls
port: 8443
listen: 0.0.0.0
users:
username1: xxxxxx
username2: xxxxxx
certificate: /root/.config/mihomo/server.crt
private-key: /root/.config/mihomo/server.key
padding-scheme: |
stop=8
0=380-620
1=600-950
2=1200-1400,c,200-500,c,400-800
3=64-128,c,1100-1400
4=1100-1400
5=80-200,c,1100-1400
6=1100-1400
7=1100-1400
- name: vless-in-1
type: vless
port: 10817 # 支持使用ports格式,例如200,302 or 200,204,401-429,501-503
listen: 0.0.0.0
# rule: sub-rule-name1 # 默认使用 rules,如果未找到 sub-rule 则直接使用 rules
# proxy: proxy # 如果不为空则直接将该入站流量交由指定 proxy 处理 (当 proxy 不为空时,这里的 proxy 名称必须合法,否则会出错)
users:
- username: 1
uuid: xxxx-xxxx-xxx-xxxx
flow: xtls-rprx-vision
# ws-path: "/" # 如果不为空则开启 websocket 传输层
# grpc-service-name: "GunService" # 如果不为空则开启 grpc 传输层
# 下面两项如果填写则开启 tls(需要同时填写)
# certificate: ./server.crt
# private-key: ./server.key
# 如果填写reality-config则开启reality(注意不可与certificate和private-key同时填写)
reality-config:
dest: www.microsoft.com:443
private-key: xxxxxxxxxxxxx # 可由 mihomo generate reality-keypair 命令生成
short-id:
- xxxxxxxxxxx # 可由 openssl rand -hex 8生成
server-names:
- www.microsoft.com
### 注意,对于vless listener, 至少需要填写 “certificate和private-key” 或 “reality-config” 的其中一项
- name: ss-in
type: shadowsocks
port: 8088
listen: 0.0.0.0
cipher: chacha20-ietf-poly1305
password: xxxxxxx
udp: true
openssl req -x509 -newkey ec:<(openssl ecparam -name prime256v1) -keyout "./server.key" -out "./server.crt" -days 36500 -nodes -subj "/CN=www.oracle.com"
Content type
Image
Digest
sha256:2924f0abb…
Size
27.2 MB
Last updated
7 months ago
docker pull koalalove/mihomo:1.19.20