构建docker镜像报错 Cannot retry request with a non-repeatable request entity: Connection reset by peer: so

具体报错如下:

[INFO] Building image localhost:5000/cloudDemo
	七月 15, 2019 9:10:45 上午 org.apache.http.impl.execchain.RetryExec execute
	信息: I/O exception (java.net.SocketException) caught when processing request to {s}->https://192.168.99.100:2376: Connection reset by peer: socket write error
	[INFO] ------------------------------------------------------------------------
	[INFO] BUILD FAILURE
	[INFO] ------------------------------------------------------------------------
	[INFO] Total time: 10.280s
	[INFO] Finished at: Mon Jul 15 09:10:45 CST 2019
	[INFO] Final Memory: 43M/483M
	[INFO] ------------------------------------------------------------------------
	[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default-cli) on project cloudDemo: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.client.ClientProtocolException: Cannot retry request with a non-repeatable request entity: Connection reset by peer: socket write error -> [Help 1]
	[ERROR] 
	[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
	[ERROR] Re-run Maven using the -X switch to enable full debug logging.
	[ERROR] 
	[ERROR] For more information about the errors and possible solutions, please read the following articles:
	[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

pom.xml 插件配置:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.6.RELEASE</version>
		<relativePath /> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.zdb</groupId>
	<artifactId>cloudDemo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	**<name>clouddemo</name>**
	<description>Demo project for Spring Boot</description>

<properties>
	<docker.image.prefix>localhost:5000</docker.image.prefix>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	<java.version>1.8</java.version>
</properties>

<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-devtools</artifactId>
		<scope>runtime</scope>
		<optional>true</optional>
	</dependency>
	<dependency>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<optional>true</optional>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
</dependencies>

<build>
	<plugins>
		<!-- springboot打包相关插件 -->
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin>
		<!-- docker打包相关插件 -->
		<plugin>
			<groupId>com.spotify</groupId>
			<artifactId>docker-maven-plugin</artifactId>
			<version>0.4.13</version>
			<configuration>
				<!-- 镜像名称必须全部小写 -->
				<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
				<dockerHost>https://192.168.99.100:2376</dockerHost>
				<dockerDirectory>src/main/docker</dockerDirectory>
				<resources>
					<resource>
						<targetPath>/</targetPath>
						<directory>${project.build.directory}</directory>
						<include>${project.build.finalName}.jar</include>
					</resource>
				</resources>
			</configuration>
		</plugin>
	</plugins>
</build>

解决办法:镜像名称全部小写例如

将	<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
替换为<imageName>${docker.image.prefix}/${project.name}</imageName>

附: 镜像构建命令 clean package docker:build
在这里插入图片描述
DOKCER_HOST配置
在这里插入图片描述

参考: https://www.wandouip.com/t5i177307/

  • 7
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
当在Docker中出现"write: connection reset by peer"错误时,可以尝试以下几个步骤进行排除: 1. 检查防火墙状态:使用命令"systemctl status firewalld"检查防火墙状态,确保防火墙已关闭。如果防火墙状态为启用,可以使用命令"systemctl disable firewalld"永久关闭防火墙。 2. 检查转发规则:使用命令"sysctl net.ipv4.ip_forward"检查转发规则是否为1。如果返回结果为0或其他值,可以通过编辑"/etc/sysctl.conf"或者"/usr/lib/sysctl.d/00-system.conf"文件,添加"net.ipv4.ip_forward=1"配置项,并重启network服务。 3. 重建docker0网桥: - 停止所有容器和docker服务:使用命令"systemctl stop docker.socket"停止docker服务,使用命令"docker stop $(docker ps -q)"停止所有容器。 - 重建docker0网桥:依次执行以下命令: ``` yum install bridge-utils -y ip link set dev docker0 down brctl delbr docker0 brctl addbr docker0 ip addr add 172.16.10.1/24 dev docker0 ip link set dev docker0 up ip addr ``` - 重新启动docker服务和容器:使用命令"systemctl start docker.socket"重启docker服务,使用命令"docker start [容器ID或名称]"启动docker容器。 如果以上步骤仍然无法解决问题,可能是由于镜像地址失效导致的。您可以尝试添加其他可用的镜像地址,如七牛云、网易云、DaoCloud镜像、科大镜像等,或者考虑配置阿里云提供的镜像加速来解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span><span class="em">4</span> #### 引用[.reference_title] - *1* [docker (56) Recv failure: Connection reset by peer](https://blog.csdn.net/weixin_53299145/article/details/121954239)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* *3* [Docker read: connection reset by peer](https://blog.csdn.net/qq_45814695/article/details/118660306)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *4* [Docker配置阿里云镜像加速pull的实现](https://download.csdn.net/download/weixin_38653508/14888679)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值