使用spring boot 2.4.1构建docker映像失败,并显示“缺少'io.buildpacks.stack.id'堆栈标签".在防火墙后面时 [英] Building docker image with spring boot 2.4.1 failes with "Missing 'io.buildpacks.stack.id' stack label" when behind a firewall
问题描述
我正在尝试使用 ./mvnw -DskipTests使用Spring Boot 2.4.1和Java 11(openjdk版本"11.0.9"; 2020-10-20 LTS).
I'm, trying to build a docker image with ./mvnw -DskipTests spring-boot:build-image
using spring boot 2.4.1 and java 11 (openjdk version "11.0.9" 2020-10-20 LTS) on RHEL7.
我是在严格防火墙后面的主机上执行此操作的,因此我必须从私有存储库中获取build-和runimage.我已经配置了spring-boot-maven-plugin来使用这个仓库:
I do this on a host behind a strict firewall so I have to fetch the build- and runimage from a private repo. I have configured the spring-boot-maven-plugin to use this 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的配置块(不在防火墙后面时)时,它工作正常.
When I try to build a docker image the same way but without the configuration block for the spring-boot-maven-plugin on my mac which is not behind a firewall it works just fine.
可以以某种方式发布SELinux吗? sudo journalctl -f
在运行mvnw命令时不列出任何内容.
Can it be SELinux releated in some way? sudo journalctl -f
don't list anything when running the mvnw command.
在此先感谢您的任何意见或建议!
Thanks in advance for any input or ideas!
-Kaj:)
推荐答案
在 base
代替了 base-cnb
.使用标签 base-cnb
可以正常工作.
On https://github.com/spring-projects/spring-boot/issues/24641 we found that I used the tag base
instead of base-cnb
. With tag base-cnb
it worked fine.
现在我得到一个 [creator]错误:无法初始化docker客户端:无法连接到docker套接字:拨打unix/var/run/docker.sock:connect:权限被拒绝
,但是那是与此问题无关.
Now I got a [creator] ERROR: failed to initialize docker client: failed to connect to docker socket: dial unix /var/run/docker.sock: connect: permission denied
but that is not related to this question.
这篇关于使用spring boot 2.4.1构建docker映像失败,并显示“缺少'io.buildpacks.stack.id'堆栈标签".在防火墙后面时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!