使用命令:mvn install -Dmaven.test.skip=true dockerfile:build 打包时候注意project>artifactId为小写否则报错

在CentOS上构建SpringBoot项目的Docker镜像时,遇到java.util.concurrent.ExecutionException异常。通过修改镜像名称为全小写解决了问题,确保artifactId为小写。

springboot项目构建docker镜像异常: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded
原创布碗 发布于2019-04-03 19:55:06 阅读数 1789  收藏
展开
异常信息
在centos上构建springboot项目的docker镜像时出现以下异常:

Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project dockerDemo: 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 -> [Help 1]

使用的是docker-maven插件,pom.xml配置如下:

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>1.0.0</version>
    <configuration>
        <imageName>${docker.image.prefix}/${project.artifactId}</imageName>
        <dockerDirectory>src/main/docker</dockerDirectory>
        <resources>
            <resource>
                <targetPath>/</targetPath>
                <directory>${project.build.directory}</directory>
                <include>${project.build.finalName}.jar</include>
            </resource>
        </resources>
    </configuration>
</plugin>

解决方法
把要构建的镜像名称全部改为小写,这里配置为<imageName>${docker.image.prefix}/${project.artifactId}</imageName>,所以要保证项目的artifactId为小写。
方案来源:

issue地址:https://github.com/spotify/docker-maven-plugin/issues/357
————————————————
版权声明:本文为CSDN博主「布碗」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sinat_36553913/article/details/89003580

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值