SpringBoot官方插件,无需自己编写Docker镜像构建过程,直接自动构建.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<!--配置镜像名称-->
<name>192.168.3.101:5000/sqkj/${project.name}:${project.version}</name>
<!--镜像打包完成后自动推送到镜像仓库-->
<publish>true</publish>
</image>
<docker>
<!--Docker远程管理地址-->
<host>http://192.168.3.101:2375</host>
<!--不使用TLS访问-->
<tlsVerify>false</tlsVerify>
<!--Docker推送镜像仓库配置-->
<publishRegistry>
<!--推送镜像仓库用户名-->
<username>test</username>
<!--推送镜像仓库密码-->
<password>test</password>
<!--推送镜像仓库地址-->
<url>http://192.168.3.101:5000</url>
</publishRegistry>
</docker>
</configuration>
</plugin>
mvn spring-boot:build-image
使用SpringBoot官方插件部署Docker 免去编写构建过程
原文:https://www.cnblogs.com/Cryan/p/15043692.html