[英]How to create docker image in Spring Boot project
I have tried using spotify/docker-maven-plugin without any success.我尝试使用 spotify/docker-maven-plugin 没有任何成功。
Below is part of my pom.xml file以下是我的 pom.xml 文件的一部分
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${dockerfile-maven-version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>myrepo/maven-docker-spotify</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}-jar-with-dependencies.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
The spotify/docker-maven-plugin you are using is currently inactive.您正在使用的spotify/docker-maven-plugin当前处于非活动状态。 It's recommended using spotify/dockerfile-maven-plugin instead.
建议使用spotify/dockerfile-maven-plugin代替。
So change the plugin section of your pom.xml file to resemble below因此,将 pom.xml 文件的插件部分更改为如下所示
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${dockerfile-maven-version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>spotify/foobar</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
Note: You can also try using JIB maven plugin that doesnt require you to have docker installed and works with minimal configuration.注意:您也可以尝试使用JIB maven 插件,该插件不需要您安装 docker 并以最少的配置工作。 With JIB, Running below command in is enough to do the jo
使用 JIB,在命令下运行就足够了
mvn compile com.google.cloud.tools:jib-maven-plugin:0.9.2:dockerBuild
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.