使用 spring boot 2.4.1 构建 docker 映像在防火墙后失败 "Missing 'io.buildpacks.stack.id' stack label"

Building docker image with spring boot 2.4.1 failes with "Missing 'io.buildpacks.stack.id' stack label" when behind a firewall

我正在尝试使用 spring boot 2.4.1 和 java 11(openjdk 版本“11.0.9”)用 ./mvnw -DskipTests spring-boot:build-image 构建一个 docker 图像2020-10-20 LTS) 在 RHEL7.

我在严格防火墙后面的主机上执行此操作,因此我必须从私有存储库中获取构建和运行图像。我已经配置了 spring-boot-maven-plugin 来使用这个 repo:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <docker>
            <builderRegistry>
                <username>my-username</username>
                <password>xxx</password>
                <url>https://my-mirror.com</url>
                <email>kaj.hejer@usit.uio.no</email>
            </builderRegistry>
        </docker>


        <image>
            <builder>my-mirror.com/library/docker.io-paketobuildpacks-builder:base</builder>
            <runImage>my-mirror.com/library/docker.io-paketobuildpacks-run:base</runImage>
            <name>my-mirror.com/my-group/my-app:latest</name>
            <verboseLogging>true</verboseLogging>
        </image>
    </configuration>
</plugin>

构建失败

[INFO]  > Pulling builder image 'my-mirror.com/library/docker.io-paketobuildpacks-builder:base' 100%
[INFO]  > Pulled builder image 'my-mirror.com/library/docker.io-paketobuildpacks-builder@sha256:cf90221a33966e42f8b1960123dea4406c65fc6a410142ded573ed850ccc313b'
[INFO]  > Pulling run image 'my-mirror.com/library/docker.io-paketobuildpacks-run:base' 100%
[INFO]  > Pulled run image 'my-mirror.com/library/docker.io-paketobuildpacks-run@sha256:56fb7587103da155db6d4f9434fd7e2f9e45d7540a062847fd84e9132a28101b'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.090 s
[INFO] Finished at: 2020-12-17T08:36:48+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.4.1:build-image (default-cli) on project my-app: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.4.1:build-image failed: Missing 'io.buildpacks.stack.id' stack label -> [Help 1]
[ERROR] 

当我尝试以相同的方式构建一个 docker 图像时,我的 mac 上没有 spring-boot-maven-plugin 的配置块,它不在防火墙它工作正常。

它能以某种方式与 SELinux 相关吗? sudo journalctl -f 当 运行 mvnw 命令时不列出任何内容。

提前感谢您的任何意见或想法!

-卡吉 :)

https://github.com/spring-projects/spring-boot/issues/24641 上,我们发现我使用了标签 base 而不是 base-cnb。使用标签 base-cnb 效果很好。

现在我得到了一个 [creator] ERROR: failed to initialize docker client: failed to connect to docker socket: dial unix /var/run/docker.sock: connect: permission denied 但这与这个问题无关。