Docker 如何将ngrok隧道连接到runner容器
我正试图使用ngrok进入我正在运行的docker容器。原因是auth项目是我们用于oauth的项目,我希望能够让我的设备(在测试时)本地连接到它。如果我在本地运行auth项目并为它定义一个特定的url,比如说像Docker 如何将ngrok隧道连接到runner容器,docker,ngrok,Docker,Ngrok,我正试图使用ngrok进入我正在运行的docker容器。原因是auth项目是我们用于oauth的项目,我希望能够让我的设备(在测试时)本地连接到它。如果我在本地运行auth项目并为它定义一个特定的url,比如说像127.0.0.1:{w.e port I want},它会正确连接,但我想通过ngrok来实现这一点。我的ngrok.yml如下所示: authtoken: {token removed for security reasons} tunnels: authentication:
127.0.0.1:{w.e port I want}
,它会正确连接,但我想通过ngrok来实现这一点。我的ngrok.yml如下所示:
authtoken: {token removed for security reasons}
tunnels:
authentication:
proto: http
addr: 44136
subdomain: mkovalskyauth
host_header: localhost
authentication.company:
image: authentication.company
environment:
DROPVIEWS: ${DROPVIEWS}
build:
context: .
dockerfile: Company.Authentication/Dockerfile
ports:
- "44136:44136"
我从docker compose项目启动auth项目的方式如下:
authtoken: {token removed for security reasons}
tunnels:
authentication:
proto: http
addr: 44136
subdomain: mkovalskyauth
host_header: localhost
authentication.company:
image: authentication.company
environment:
DROPVIEWS: ${DROPVIEWS}
build:
context: .
dockerfile: Company.Authentication/Dockerfile
ports:
- "44136:44136"
我添加了端口部分,因为我们当然需要将端口公开给internet,以便docker能够正确连接到它。当我使用ngrok start--all
(我在Windows上)运行ngrok时,当我导航到url mkovalskyauth.ngrok.io时,会出现502错误。有趣的是,我的docker compose还使用预期的mongo端口27017定义了一个mongodb容器,如果我要更新ngrok.yml以指向该端口并导航到该端口,那么我在浏览器中会得到一个正确的响应“连接到mongo时,您似乎在使用html”,这非常清楚,隧道工作正常。我错过了哪一步