我想要构建一个Docker映像,并将其推送到自定义注册表(gcr.io/<myid>/demo123)。但是,maven插件总是使用项目的组/工件id来派生图像标记。我以为我可以通过<name>标记<image>手动配置标签,但这不起作用.有什么想法吗?
执行maven目标fabric8:build将导致
[INFO] F8: Successfully tagged example/demo:snapshot-180210-220255-0223
[INFO] F8: [example/demo:snapshot-180210-220255-0223] "spring-boot": Built image sha256:003d6
[INFO] F8: [example/demo:snapshot-180210-220255-0223] "spring-boot": Tag with latest这是我的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>3.5.33</version>
<configuration>
<verbose>true</verbose>
<images>
<image>
<name>gcr.io/myid/demo123</name>
</image>
</images>
</configuration>
<executions>
<execution>
<id>fmp</id>
<goals>
<goal>resource</goal>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
提前感谢!
解决方案:https://github.com/fabric8io/fabric8-maven-plugin/issues/1180
发布于 2018-12-19 16:22:38
遇到了同样的问题。添加标记build修复了它。解释不了为什么,也许有人知道。
<images>
<image>
<name>gcr.io/myid/demo123</name>
<build></build>
</image>
</images>发布于 2018-03-25 09:18:15
我在pom.xml中配置了这种方式,它起作用了。
```javascript建筑轮廓
<plugins> <plugin> <groupId>io.fabric8</groupId> <artifactId>fabric8-maven-plugin</artifactId> <version>3.5.35</version> <configuration> <images> <image> <name>{image.user}/{image.name}:{image.tag}</name> </image> </images></configuration><executions> <execution> <goals> <goal>resource</goal> <goal>build</goal> </goals> </execution></executions>
我点击mvn干净安装-Pbuildprofile
https://stackoverflow.com/questions/48725569
复制相似问题