具体的harbor配置和docker配置可以查看前面几篇,也包含了我遇到的问题

settings.xml配置

<server>
<id>docker-hub</id>
<username>admin</username>
<password>Harbor12345</password>
</server>

pom.xml配置

</parent>
<groupId>com.topcheer</groupId>
<artifactId>docker</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>docker</name>
<description>Demo project for Spring Boot</description> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<docker.image.prefix>topcheer</docker.image.prefix>
<docker.repostory>192.168.180.105:1180</docker.repostory>
</properties> <dependencies> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies> <repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories> <build>
<finalName>docker</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--加入下面两项配置-->
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>tag-image</id>
<phase>package</phase>
<goals>
<goal>tag</goal>
</goals>
<configuration>
<image>${docker.repostory}/${docker.image.prefix}/${project.artifactId}:1.0.1</image>
<newName>${docker.repostory}/${docker.image.prefix}/${project.artifactId}:1.0.1</newName>
</configuration>
</execution>
<execution>
<id>push-image</id>
<phase>deploy</phase>
<goals>
<goal>push</goal>
</goals>
<configuration>
<imageName>${docker.repostory}/${docker.image.prefix}/${project.artifactId}:1.0.1</imageName>
</configuration>
</execution>
</executions>
<configuration>
<serverId>docker-hub</serverId>
<registryUrl>${docker.repostory}</registryUrl>
<dockerHost>http://192.168.180.105:2375</dockerHost>
<forceTags>true</forceTags>
<pushImage>true</pushImage>
<dockerDirectory>src/main/docker</dockerDirectory>
<imageName>${docker.repostory}/${docker.image.prefix}/${project.artifactId}:1.0.1</imageName>
<imageTags>
<imageTag>1.0.2</imageTag>
</imageTags>
<resources>
<rescource>
<targetPath></targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</rescource>
</resources>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>

运行命令

clean package docker:build -DpushImage -Dmaven.test.skip=true

最新文章

  1. GPS部标平台的架构设计(九)-GPS监控客户端设计
  2. linux 解压命令大全
  3. Duilib学习笔记《06》— 窗体基类WindowImpBase
  4. Windows Phone 7 中拷贝文件到独立存储
  5. keditor_php图片上传
  6. jquery trigger伪造a标签的click事件取代window.open方法
  7. HDU 3501 Calculation 2 (欧拉函数)
  8. java对称加密报错:Input length must be multiple of 8 when decrypting with padded cipher
  9. C# 写XML文件
  10. 整理幾種常見PCB表面處理的優缺點
  11. python只re模块
  12. ansible 拷贝文件并重启服务
  13. zTree实现删除树节点
  14. python购物车demo
  15. 自定义一个IOC框架
  16. Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager
  17. python基础数据类型--list列表
  18. mysql授权远程访问
  19. 全排列问题Ⅰ(Java实现)
  20. 洛谷 P2431 正妹吃月饼 解题报告

热门文章

  1. Openstack_SQLAlchemy_一对多关系表的多表插入实现
  2. sort_values()和sort_index()函数
  3. 类Thread
  4. C#之委托(二)
  5. SSM Maven MallDemo项目为例
  6. 【FICO系列】SAP 财务帐与后勤不一致情况
  7. Mybatis-学习笔记(2)Mybatis配置文件
  8. 使用sql追踪
  9. 用命令行远程导出MySQL数据
  10. P3379 【模板】最近公共祖先(LCA)(欧拉序+rmq)