当前位置:网站首页>curl: (56) Recv failure: Connection reset by peer
curl: (56) Recv failure: Connection reset by peer
2022-06-29 16:16:00 【一 乐】
Docker 重定向问题: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、在浏览器测试,考虑服务器的安全组或防火墙是否放行:

如果本文对你有帮助的话记得给一乐点个赞哦,感谢!
边栏推荐
- Which version of JVM is the fastest?
- Key wizard play monster learning - multi window and multi thread background judgment of character, pet blood volume and pet happiness
- 稳定币风险状况:USDT 和 USDC 安全吗?
- 南京大学:新时代数字化人才培养方案探讨
- 【OpenGL】杂谈一、通过鼠标拖拽实现相机绕空间中的某点进行球面旋转查看
- 八年测开经验面试28K公司后,吐血整理出高频面试题和答案
- 实战 | 神奇的 conic-gradient 圆锥渐变
- MATLAB输出格式控制 %d,%f,%c,%s的用法
- 『计组』CPU 如何区分指令和数据
- Cerebral cortex: predicting children's mathematical skills from task state and resting state brain function connections
猜你喜欢
![leetcode:535. Encryption and decryption of tinyurl [mapping of URL and ID, ID self increment]](/img/16/6684eaadc949e27c66a742100cb8f8.png)
leetcode:535. Encryption and decryption of tinyurl [mapping of URL and ID, ID self increment]

DAP large screen theme development description

或许再过两年,ASML将可以自由给中国供应EUV光刻机

Privacy computing helps secure data circulation and sharing

水球图-利用动态波纹展示百分比

Stable currency risk profile: are usdt and usdc safe?

UWB精准定位方案,厘米级高精度技术应用,智能配对感应技术

工具链赋能百家,地平线开启智能驾驶量产的“马太效应”

CV5200自组网远程WiFi模组,无人机无线图传应用,高清低时延方案

【OpenGL】杂谈一、通过鼠标拖拽实现相机绕空间中的某点进行球面旋转查看
随机推荐
What are the advantages of SaaS services
C语言——printf打印进制前缀
能够1年涨薪2次的软件测试工程师,他到底强在哪里?
[day 28] given a string s, please judge whether it is a palindrome string | palindrome judgment
【Proteus仿真】数码管+4x4键盘矩阵按键简易计算器
Cv5200 ad hoc network remote WiFi module, UAV wireless image transmission application, HD low delay scheme
都3年测试经验了,用例设计还不知道状态迁移法?
小程序在产业互联网有「大」作为
又拍云 Redis 的改进之路
Comment configurer logback? 30 minutes pour apprendre à coder et à frapper tard.
To solve the stubborn problem of Lake + warehouse hybrid architecture, Star Ring Technology launched an independent controllable cloud native Lake warehouse integrated platform
scratch报时的公鸡 电子学会图形化编程scratch等级考试一级真题和答案解析2022年6月
按键精灵打怪学习-窗口绑定保护技能和点击技能
天龙八部TLBB系列 - 如何让宠物学习十二满技能
实战 | Change Detection And Batch Update
leetcode:232. Realize queue with stack [two stacks, one auxiliary and one simulated queue]
全面剖析Seata 分布式事务 AT 与XA
一个简单但是能上分的特征标准化方法
DAP大屏主题开发说明
What is the strength of a software testing engineer who can get a salary increase twice a year?