通过maven推送镜像到SWR仓库-故障处理一例
【摘要】 * 基础配置参考maven(0.4)那篇即可,此处不再赘述;
* 此篇为排错篇,被华为云SWR仓库坑惨了;
* 此篇只对比各个不同的maven-docker-plugin版本,在使用中的区别;
1. 说明
-
-
此篇为排错篇,被华为云SWR仓库坑惨了;
-
此篇只对比各个不同的maven-docker-plugin版本,在使用中的区别;
2.排错过程
2.1.起因
客户的代码环境均是在本地,包括gitlib仓库也是部署在本地;
客户希望通过本地IDE环境,在线下实现代码开发,并通过Maven的maven-docker-plugin插件,实现本地容器镜像封装,同时推送容器镜像到华为云SWR镜像仓库,尽可能的实现发布流程自动化;
但是在实现的时候,往华为云上推送镜像时,一直出错,无法成功推送;
插件推送时,报错信息如下:
[INFO] Pushing swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0
The push refers to repository [swr.cn-east-2.myhuaweicloud.com/busyfan/my-web]
[WARNING] Failed to push swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0, retrying in 10 seconds (1/5).
[INFO] Pushing swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0
The push refers to repository [swr.cn-east-2.myhuaweicloud.com/busyfan/my-web]
[WARNING] Failed to push swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0, retrying in 10 seconds (2/5).
[INFO] Pushing swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0
The push refers to repository [swr.cn-east-2.myhuaweicloud.com/busyfan/my-web]
[WARNING] Failed to push swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0, retrying in 10 seconds (3/5).
[INFO] Pushing swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0
The push refers to repository [swr.cn-east-2.myhuaweicloud.com/busyfan/my-web]
[WARNING] Failed to push swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0, retrying in 10 seconds (4/5).
[INFO] Pushing swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0
The push refers to repository [swr.cn-east-2.myhuaweicloud.com/busyfan/my-web]
[WARNING] Failed to push swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0, retrying in 10 seconds (5/5).
[INFO] Pushing swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0
The push refers to repository [swr.cn-east-2.myhuaweicloud.com/busyfan/my-web]
Failed to push swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0, retrying in 10 seconds (5/5).
Failed to execute goal com.spotify:docker-maven-plugin:1.2.2:build (default-cli) on project docker-plugin122: Exception caught
2.2.先说结论
快下班的时候,突然想着,要不往hub.docker.com上推送一下试试看,没马想竟然一下子就推送成功了,我cao;
实在没想到是华为云SWR平台有问题啊。。。
找到问题所在就好办了,换到华东-上海一地域,也是一下子就推送成功了,了然。
插件版本 | 华为-华东-上海一 | 华为-华东-上海二 | hub.docker.com |
---|---|---|---|
0.4.13 | 推送成功 | 推送成功 | 推送成功 |
1.2.2 | 推送成功 | 推送失败 | 推送成功 |
上表是各种测试后的结果;
因为日常默认使用的地域就是(华东-上海二),所以就被抗了一天时间;
没想到会是SWR平台的问题,是因为前几天使用0.4.13版本的插件,是能成功的。
2.3.不同环境对应的pom.xml
a.华东-上海一
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<!-- <version>1.2.2</version> -->
<configuration>
<!-- 镜像名称 -->
<imageName>swr.cn-east-3.myhuaweicloud.com/busyfan/my-web:1.0</imageName>
<!-- <imageTags>-->
<!-- <imageTag>${project.version}</imageTag>-->
<!-- </imageTags>-->
<dockerHost>http://192.168.10.84:2375</dockerHost>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<!-- 下面的busyfan,是在settings.xml里配置的华为云的登录信息 -->
<serverId>busyfan</serverId>
</configuration>
</plugin>
b.华东-上海二
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<!-- <version>1.2.2</version> -->
<configuration>
<!-- 镜像名称,由两部分组成:
1. 地域endpoint:swr.cn-east-2.myhuaweicloud.com
2. 该地域内创建的组织名称:busyfan -->
<imageName>swr.cn-east-2.myhuaweicloud.com/busyfan/my-web:1.0</imageName>
<dockerHost>http://192.168.10.84:2375</dockerHost>
<baseImage>java:8</baseImage>
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<serverId>busyfan</serverId>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<!-- <version>1.2.2</version> -->
<configuration>
<!-- 镜像名称,镜像前缀为docker.com上的用户名称 -->
<imageName>yangzb/my-web:1.0</imageName>
<dockerHost>http://192.168.10.84:2375</dockerHost>
<baseImage>java:8</baseImage>
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<!-- 下面的yangzb,是在settings.xml里配置的 docker.com 的登录信息 -->
<serverId>yangzb</serverId>
</configuration>
</plugin>
3.总结
所以这就算是个BUG了吧。
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)