docker - curl (56) 接收失败 : Connection reset by peer - when hitting docker container

标签 docker curl port dockerfile

curl 应用程序 ip 时出现此错误

curl (56) Recv 失败:连接被对等方重置 - 当访问 docker 容器时

最佳答案

通过运行做一个小检查:

docker run --network host -d <image>

如果 curl 在此设置下运行良好,请确保:

  1. 您正确地将主机端口映射到容器的端口:
docker run -p host_port:container_port <image>
  1. 您的服务应用程序(在容器中运行)正在 localhost0.0.0.0 上运行,而不是 127.0。 0.1

关于docker - curl (56) 接收失败 : Connection reset by peer - when hitting docker container,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50155033/

相关文章:

debugging - 如何在 Ubuntu 上使用 GDB 调试需要打开低端口的应用程序

amazon-web-services - AWS CLI v2 的哪些命令 `replace aws ecr get-login`

email - 如何在 docker/redmine 容器实例上配置 'smtp ' 设置?

shell - 在shell脚本中使用curl

javascript - 将对象数组传递给curl

c++ - 执行 POST 请求时服务器的响应字符串不完整

amazon-web-services - AWS ElasticBeanstalk 找不到 Dockerfile

docker compose build 上的 Dockerfile 传递环境

port - VHDL:使用 inout 端口是不好的做法吗?

php - Apache 意外关闭