首页 > 解决方案 > 从 Shinyproxy 内的 docker 容器连接到 Api

问题描述

我部署了一个管道工 API,可以通过以下方式访问:

curl -X GET " http://vps546862.ovh.net:8000/dep?q=Ain " -H "accept: application/json"

它在我的计算机上运行良好,甚至在没有闪亮代理的服务器上的最小容器(ubuntu + curl)内也能正常工作。

但是在带有 shinyproxy 的服务器上,这不再起作用了。相反,我收到错误消息:

curl: (7) 无法连接到 vps546862.ovh.net 端口 8000: No route to host

它在由 shinyproxy 启动的容器和手动启动的容器内不起作用。

我在 docker 上做的唯一配置是这个:

ExecStart=/usr/bin/dockerd -H fd:// -D -H tcp://127.0.0.1:2375

除了这个问题,一切正常……</p>

使用 shinyproxy 从同一服务器上的高山容器输出:

docker run --rm -it alpine /bin/ash    
/ # ping vps546862.ovh.net   
PING vps546862.ovh.net (54.38.181.183): 56 data bytes
64 bytes from 54.38.181.183: seq=0 ttl=64 time=0.115 ms
64 bytes from 54.38.181.183: seq=1 ttl=64 time=0.132 ms
64 bytes from 54.38.181.183: seq=2 ttl=64 time=0.180 ms
64 bytes from 54.38.181.183: seq=3 ttl=64 time=0.142 ms
--- vps546862.ovh.net ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.115/0.142/0.180 ms
/ # ip route
default via 172.17.0.1 dev eth0
172.17.0.0/16 dev eth0 scope link  src 172.17.0.4
/ # curl -X GET "http://vps546862.ovh.net:8000/dep?q=Ain" -H "accept: application/json"
curl: (7) Failed to connect to vps546862.ovh.net port 8000: Host is unreachable

标签: rdockershinyplumbershinyproxy

解决方案


推荐阅读