【发布时间】: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