需要帮忙。一直在尝试解决此问题,但找不到答案,或者我没有遇到任何问题。
我有一个带有NGINX的docker容器,充当反向代理。适用于Windows的Docker版本1.12.5(9503)。
upstream mysite {
server 127.0.0.1:8090;
#server localhost:8090; (have also tried this option)
}
server {
listen 0.0.0.0:80;
server_name localhost;
location / {
proxy_pass http://mysite;
}
}
2016/12/27 08:11:57 [error] 6#6: *4 no live upstreams while connecting to upstream, client: 172.17.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://googlesite/", host: "localhost"
172.17.0.1 - - [27/Dec/2016:08:11:57 +0000] "GET / HTTP/1.1" 502 173 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0" "-"
(simple HTML site, single page with only simple html, hosted on IIS with anonymous access granted to all.)
curl localhost:8090
curl: (7) Failed to connect to localhost port 8090: Connection refused
在docker容器内,localhost
和127.0.0.1
指的是容器本身。为了访问与您的容器一起运行dockerd的主机,您必须通过其公用主机名/IP引用该主机,就好像该主机是网络上的另一台计算机一样。
关于curl7)无法连接到本地主机端口8090:连接被拒绝,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/41363529/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |