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

如果本文对你有帮助的话记得给一乐点个赞哦,感谢!
边栏推荐
- Are the top ten domestic securities companies safe?
- JS 会有变量提升和函数提升
- 《canvas》之第7章 变形操作
- Yi Ming ang Ke rushed to Hong Kong shares: loss of 730million in the year Lilly and sunshine life insurance were shareholders
- 论文学习——考虑场次降雨年际变化特征的年径流总量控制率准确核算
- China arsenic trioxide industry research and future forecast report (2022 Edition)
- Kubernetes pod troubleshooting guide
- Istio网格中访问外部服务方法
- 高并发软件(网站,服务器端接口)的评价指标
- 捷氢科技冲刺科创板:拟募资10.6亿 上汽集团是大股东
猜你喜欢

Stm32 mbed tutorial (IV) --pwm

Chinese garbled code output from idea output station

redis在window和Linux环境下的安装

MySQL中100w数据表比1000w数据表查询更快吗?

精品商城拼团秒杀优惠折扣全功能完美双端自适应对接个人免签网站源码

Wei long updated the prospectus: the annual revenue of 4.8 billion founder liuweiping has a strong family color

校园转转二手市场源码

Trigonometric function corresponding to drawing circle on plane coordinate
![[practical chapter of correlation analysis] why can't Bi software do correlation analysis](/img/f2/4f99deb63b1beffae90b8a1fb270d1.png)
[practical chapter of correlation analysis] why can't Bi software do correlation analysis

Chapter 12 other applications of canvas
随机推荐
Build your own website (19)
Chapter 12 other applications of canvas
Chapter 6 picture operation of canvas
知乎热议:一个程序员的水平能差到什么程度?
Introduction to bloom filter
《canvas》之第11章 canvas状态
模电 2个NPN管组成的恒流源电路分析
【重要通知】中国图象图形学学会2022年度系列奖励推荐工作启动
Are the top ten domestic securities companies safe?
VQA needs not only pictures, but also external knowledge! University of Washington & Microsoft proposed revive, using gpt-3 and wikidata to help answer questions
三角函数对应在平面坐标上画圆
【blackduck】jenkins下配置指定的synopsys-detect扫描版本
Kubernetes pod troubleshooting guide
Are you still reading the log by command? Use kibana, one picture is better than ten thousand lines of log
If I am in Foshan, where can I open an account? Is it safe to open an account online?
如果我在佛山,到哪里开户比较好?究竟网上开户是否安全么?
阿里云体验有奖:使用PolarDB-X与Flink搭建实时数据大屏
传输层 选择性确认 SACK
[shell] Jenkins shell realizes automatic deployment
关于项目采购管理,这些你需要知道