【问题标题】:curl requests to nginx:alpine docker image being rejected Recv failure: Connection reset by peer对 nginx 的 curl 请求:alpine docker 映像被拒绝 Recv 失败:连接由对等方重置
【发布时间】:2021-02-16 14:32:37
【问题描述】:

我正在尝试调试为什么在我的 ubuntu 20.04 机器上拒绝发送到 docker 容器的 curl 请求。我正在运行股票nginx:alpine 图像。

chris@chris-Precision-7920-Tower  ~  docker images                                                                                                                               
nginx          alpine                  629df02b47c8   2 months ago    22.3MB
hello-world    latest                  bf756fb1ae65   13 months ago   13.3kB
openjdk        8-jdk-alpine            a3562aa0b991   21 months ago   105MB
 chris@chris-Precision-7920-Tower  ~  docker run  -p 8081:80 nginx:alpine                                                                                                           ✔  5437  08:20:32
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Configuration complete; ready for start up

然后我尝试向容器发送请求

curl http://0.0.0.0:8081/
curl: (56) Recv failure: Connection reset by peer

我在更复杂的图像/容器上遇到过这种情况,但这似乎是最小的可重现示例。通过我更复杂的示例,我确保绑定到容器内部的0.0.0.0 而不是127.0.0.1/localhost。

码头工人版本

chris@chris-Precision-7920-Tower  ~  docker --version                        ✔  5447  08:39:08
Docker version 20.10.3, build 48d30b5
 chris@chris-Precision-7920-Tower  ~  dockerd --version                       ✔  5449  08:46:24
Docker version 20.10.3, build 46229ca

【问题讨论】:

    标签: docker


    【解决方案1】:

    对于以后遇到这个问题的傻瓜(比如我自己),这是我的VPN造成的。

    关闭我的 VPN 后,一切都会按预期进行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-22
      • 1970-01-01
      • 1970-01-01
      • 2021-07-08
      • 2014-09-13
      • 1970-01-01
      • 2019-02-28
      相关资源
      最近更新 更多