curl: (56) Recv failure: Connection reset by peer

简介: curl: (56) Recv failure: Connection reset by peer

解决思路

☺ 以下考虑情况,针对的是docker部署springboot项目,我在springboot的配置文件 application.properties 设置了端口为 8848


1、考虑是不是端口冲突了 ,比如当前运行的项目的端口是8848,然而在项目运行之前已经有一个老项目运行了,且老项目的端口也是8848

# 查看端口占用情况
netstat -lntp | grep 8848


2、考虑项目端口是否忘记暴露了,前提是项目是用dockerfile构建,若是dockerCompose看第三点

■ 具体情况如下:可以看到端口位置为空

  • dockerfile内容:


解决方式1:dockerfile文件中添加上EXPOSE 端口号,且创建启动容器的时候选择端口映射 -p 端口号: 容器端口(expose 8848)

添加上EXPOSE 端口号暴露的方式,只能暴露给其他容器使用,而无法暴露给主机使用,即curl localhost:端口号 是访问不到的,需要做端口映射 -p 宿主的端口:dockerfile暴露的端口,然后才能在宿主机访问


3、考虑项目是否存在多种环境的配置文件[application.yml 或 application.properties],例如既有开发环境[application.properties],也有生产环境的配置文件[application-prod.properties],且你的目的是docker运行的配置文件是生产环境的,则需要在打包前需要选择好生成环境的配置文件

☺ 补充一下命令行 -U clean package 的作用:让打包打包得更加完整,避免打包的jar包没能从远程仓库下载完整,出现was cached in the local repository的错误,加上命令行-U clean package


4、考虑使用-p做端口映射,在测试的时候端口号是否填写正常:


5、在浏览器测试,考虑服务器的安全组或防火墙是否放行:


如果本文对你有帮助的话记得给一乐点个赞哦,感谢!

目录
相关文章
|
4月前
|
Go 开发工具 git
【git】解决:Failed to connect to 127.0.0.1 port 7890: Connection refused
【git】解决:Failed to connect to 127.0.0.1 port 7890: Connection refused
512 0
|
11月前
|
网络协议 安全 Linux
如何修复 SSH Client_loop: send disconnect: Broken pipe Error
如何修复 SSH Client_loop: send disconnect: Broken pipe Error
1565 1
|
Python
ConnectionResetError: [Errno 104] Connection reset by peer
ConnectionResetError: [Errno 104] Connection reset by peer
473 0
|
数据安全/隐私保护
记录curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused解决方案
关于这个错误其实遇到过好多次了,基本都是在每次换电脑之后执行
记录curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused解决方案
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
161 0
|
网络协议 Java
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer
330 0
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer
|
开发工具 git
git 报错 RPC failed; curl 18 transfer closed with outstanding read data remaining
这个错误是因为项目太久,tag资源文件太大 找了很久网上都说这样: 配置如下: $ git  config --global http.
8599 0
|
网络协议
OGG-01232 Receive TCP params error: TCP/IP error 104 (Connection reset by peer), endpoint:
源端: 2015-02-05 17:45:49 INFO OGG-01815 Virtual Memory Facilities for: COM anon alloc: mmap(MAP_ANON) anon free: munmap file alloc: mmap(MAP_SH...
3054 0
|
缓存 开发工具 git
Git报错Error:RPC failed; curl 18 transfer closed with outstanding read data remaining
Git报错Error:RPC failed; curl 18 transfer closed with outstanding read data remaining
330 0
|
网络协议
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused解决方案
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused解决方案
424 0
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused解决方案