将java项目容器化push到远程registries:

<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>0.9.6</version>
<configuration>
<from>
<!--base image-->
<image>openjdk:alpine</image>
</from>
<to>
<!--<image>registry.cn-hangzhou.aliyuncs.com/m65536/jibtest</image>-->
<!--目标镜像registry地址,为了方便测试,你需要换成自己的地址,如果你的网络不好,可以选用国内加速器,比如阿里云的-->
<image>registry.hub.docker.com/moxingwang/jibtest</image>
</to>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>

构建镜像:

mvn compile jib:build

把镜像直接构建到本地docker中(本地得有docker环境):

mvn compile jib:dockerBuild