1.下载镜像
docker pull hteen/ngrok
2.启动一个容器生成ngrok客户端,服务器端和CA证书
docker run --rm -it -e DOMAIN="test.test.com" -v /root/ngrok:/myfiles hteen/ngrok /bin/sh /build.sh
3.启动Ngrok server
docker run -idt --name ngrok-server -v /root/ngrok:/myfiles -p 80:80 -p 443:443 -p 4443:4443 -e DOMAIN='test.test.com' --restart=always hteen/ngrok /bin/sh /server.sh
4.创建本地config.yml配置文件,文件内容:
server_addr: "test.test.com:4443"
trust_host_root_certs: false
tunnels:
client:
subdomain: "lumingbao"
proto:
https: 80
5.根据平台下载对应的客户端工具并启动
./ngrok -config=config.yml start client
来源:oschina
链接:https://my.oschina.net/lumingbao/blog/3215506