gpt4 book ai didi

maven - 如何使用fabric8-maven-plugin标记图像?

转载 作者:行者123 更新时间:2023-12-02 19:33:23 25 4
gpt4 key购买 nike

我想使用fabric8-maven-plugin构建一个Docker镜像并将其推送到自定义注册表(gcr.io/<myid>/demo123)。但是,maven插件始终使用项目的组/ Artifact 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

最佳答案

遇到同样的问题。添加标签build修复了该问题。无法解释为什么,也许别人知道。

<images>
<image>
<name>gcr.io/myid/demo123</name>
<build></build>
</image>
</images>

关于maven - 如何使用fabric8-maven-plugin标记图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48725569/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com