docker 在Springboot中为Docket构建映像时,生成器生命周期“creator”失败,状态代码为51

czfnxgou  于 2023-04-20  发布在  Docker
关注(0)|答案(1)|浏览(188)

我正在学习Dan Vega的springboot课程,https://www.youtube.com/watch?v=UgX5lgv4uVM。我得到了一个错误,我似乎无法绕过。
当我尝试在maven中使用mvn spring-boot:build-image为Docker创建镜像时,我得到了这个错误“Builder lifecycle 'creator' failed with status code 51”。

[INFO] 
[INFO] --- spring-boot-maven-plugin:3.0.1:build-image (default-cli) @ content-calendar ---
[INFO] Building image 'docker.io/library/content-calendar:0.0.1-SNAPSHOT'
[INFO] 
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 100%
[INFO]  > Pulled builder image 'paketobuildpacks/builder@sha256:dd98964477407e67eb6620450c4f4a5d2236f8fdc8e6569ce3778318aa4b7e64'
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' 100%
[INFO]  > Pulled run image 'paketobuildpacks/run@sha256:41443690a2dc36118112db2c4790dc2bc8189926dae9ff91992b78675d0cac39'
[INFO]  > Executing lifecycle version v0.16.1
[INFO]  > Using build cache volume 'pack-cache-b6484801b9ac.build'
[INFO] 
[INFO]  > Running creator
[INFO]     [creator]     ===> ANALYZING
[INFO]     [creator]     Image with name "docker.io/library/content-calendar:0.0.1-SNAPSHOT" not found
[INFO]     [creator]     ===> DETECTING
[INFO]     [creator]     6 of 26 buildpacks participating
[INFO]     [creator]     paketo-buildpacks/ca-certificates   3.6.1
[INFO]     [creator]     paketo-buildpacks/bellsoft-liberica 10.1.0
[INFO]     [creator]     paketo-buildpacks/syft              1.28.0
[INFO]     [creator]     paketo-buildpacks/executable-jar    6.6.3
[INFO]     [creator]     paketo-buildpacks/dist-zip          5.5.2
[INFO]     [creator]     paketo-buildpacks/spring-boot       5.23.0
[INFO]     [creator]     ===> RESTORING
[INFO]     [creator]     ===> BUILDING
[INFO]     [creator]     
[INFO]     [creator]     Paketo Buildpack for CA Certificates 3.6.1
[INFO]     [creator]       https://github.com/paketo-buildpacks/ca-certificates
[INFO]     [creator]       Launch Helper: Contributing to layer
[INFO]     [creator]         Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[INFO]     [creator]     
[INFO]     [creator]     Paketo Buildpack for BellSoft Liberica 10.1.0
[INFO]     [creator]       https://github.com/paketo-buildpacks/bellsoft-liberica
[INFO]     [creator]       Build Configuration:
[INFO]     [creator]         $BP_JVM_JLINK_ARGS           --no-man-pages --no-header-files --strip-debug --compress=1  configure custom link arguments (--output must be omitted)
[INFO]     [creator]         $BP_JVM_JLINK_ENABLED        false                                                        enables running jlink tool to generate custom JRE
[INFO]     [creator]         $BP_JVM_TYPE                 JRE                                                          the JVM type - JDK or JRE
[INFO]     [creator]         $BP_JVM_VERSION              17                                                           the Java version
[INFO]     [creator]       Launch Configuration:
[INFO]     [creator]         $BPL_DEBUG_ENABLED           false                                                        enables Java remote debugging support
[INFO]     [creator]         $BPL_DEBUG_PORT              8000                                                         configure the remote debugging port
[INFO]     [creator]         $BPL_DEBUG_SUSPEND           false                                                        configure whether to suspend execution until a debugger has attached
[INFO]     [creator]         $BPL_HEAP_DUMP_PATH                                                                       write heap dumps on error to this path
[INFO]     [creator]         $BPL_JAVA_NMT_ENABLED        true                                                         enables Java Native Memory Tracking (NMT)
[INFO]     [creator]         $BPL_JAVA_NMT_LEVEL          summary                                                      configure level of NMT, summary or detail
[INFO]     [creator]         $BPL_JFR_ARGS                                                                             configure custom Java Flight Recording (JFR) arguments
[INFO]     [creator]         $BPL_JFR_ENABLED             false                                                        enables Java Flight Recording (JFR)
[INFO]     [creator]         $BPL_JMX_ENABLED             false                                                        enables Java Management Extensions (JMX)
[INFO]     [creator]         $BPL_JMX_PORT                5000                                                         configure the JMX port
[INFO]     [creator]         $BPL_JVM_HEAD_ROOM           0                                                            the headroom in memory calculation
[INFO]     [creator]         $BPL_JVM_LOADED_CLASS_COUNT  35% of classes                                               the number of loaded classes in memory calculation
[INFO]     [creator]         $BPL_JVM_THREAD_COUNT        250                                                          the number of threads in memory calculation
[INFO]     [creator]         $JAVA_TOOL_OPTIONS                                                                        the JVM launch flags
[INFO]     [creator]         Using Java version 18 extracted from MANIFEST.MF
[INFO]     [creator]       No valid JRE available, providing matching JDK instead. Using a JDK at runtime has security implications.
[INFO]     [creator]        : Contributing to layer
[INFO]     [creator]     unable to invoke layer creator
[INFO]     [creator]     unable to get dependency 
[INFO]     [creator]     unable to download 
[INFO]     [creator]     unable to request 
[INFO]     [creator]     Get "": unsupported protocol scheme ""
[INFO]     [creator]       Warning: Dependency has no SHA256. Skipping cache.
[INFO]     [creator]         Downloading from 
[INFO]     [creator]     ERROR: failed to build: exit status 1

在实际构建enter image description here图像之前,我正在通过maven构建图像过程的所有步骤
[INFO] [creator]未找到名为“docker.io/library/content-calendar:0.0.1-SNAPSHOT”的图像是问题所在的行。我对所有SpringBoot,Maven和Docker都很陌生。我使用的是Dan在https://github.com/danvega/content-calendar的视频速成课程中提供的确切代码(与讲师一起工作)。
要从mvn成功构建Image,请使用spring-boot:build-image for the Docker

x6yk4ghg

x6yk4ghg1#

你这里的错误是关于

Using Java version 18 extracted from MANIFEST.MF
No valid JRE available

这是意料之中的,因为Paketo Buildpack for BellSoft Liberica 10.1.0不提供JDK或JRE版本18(它只支持LTS JVM版本+最新版本,目前是20;所以没有18
从您尝试构建OCI映像的jar的MANIFEST.MF中检测到18版本;它本身是从用于构建应用程序的JVM设置的。
我建议您在您的机器上使用JDK版本1720;在JDK之间切换的一种方便方法是使用SDKMAN!
希望有帮助!

相关问题