Spring Boot 2.3.0 bootBuildImage失败

时间:2020-05-25 04:21:09

标签: spring-boot spring-boot-gradle-plugin

我已将项目更新为使用springboot 2.3.0,并尝试使用默认的springboot gradle任务bootBuildImage构建docker映像。

该项目是一个简单的其余项目,分为两个部分:-接口定义和接口实现。在使用Dockerfile生成映像时,所有这些都在尝试,但是我正在尝试使用新功能。

我没有更改任何配置,也没有添加任何自定义项。我只是普通的任务,但遇到了以下问题。

DAREYOURDREAM-96TZ:tm-provisioning dareyourdream$ gradle bootBuildImage --scan
Picked up _JAVA_OPTIONS: -Xms1024m -Xmx8192m -XX:MaxPermSize=1024m
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0

> Task :bootBuildImage
Building image 'docker.io/library/tm-provisioning:0.0.1-SNAPSHOT'

 > Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' ..................................................
 > Pulled builder image 'gcr.io/paketo-buildpacks/builder@sha256:200fb7945ef0f4a3c79befb1262fd592f54ba7b7ffcc8a37716434dd11d0e5e9'
 > Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' ..................................................
 > Pulled run image 'gcr.io/paketo-buildpacks/run@sha256:f7f27462fb513a70370322ada08440a642d24a700056d4c6b8cbb344610bf486'
 > Executing lifecycle version v0.7.5
 > Using build cache volume 'pack-cache-defc64ac2d6d.build'

 > Running creator
    [creator]     ---> DETECTING
    [creator]     5 of 15 buildpacks participating
    [creator]     paketo-buildpacks/bellsoft-liberica 2.7.1
    [creator]     paketo-buildpacks/executable-jar    1.2.5
    [creator]     paketo-buildpacks/apache-tomcat     1.1.5
    [creator]     paketo-buildpacks/dist-zip          1.3.2
    [creator]     paketo-buildpacks/spring-boot       1.5.5
    [creator]     ---> ANALYZING
    [creator]     Previous image with name "docker.io/library/tm-provisioning:0.0.1-SNAPSHOT" not found
    [creator]     Skipping buildpack layer analysis
    [creator]     ---> BUILDING
    [creator]     
    [creator]     Paketo BellSoft Liberica Buildpack 2.7.1
    [creator]         Set $BPL_JVM_HEAD_ROOM to configure the headroom in memory calculation. Default 0.
    [creator]         Set $BPL_JVM_LOADED_CLASS_COUNT to configure the number of loaded classes in memory calculation. Default 35% of classes.
    [creator]         Set $BPL_JVM_THREAD_COUNT to configure the number of threads in memory calculation. Default 250.
    [creator]         Set $BP_JVM_VERSION to configure the Java version. Default 11.*.
    [creator]       BellSoft Liberica JRE 8.0.252: Contributing to layer
    [creator]         Downloading from https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jre8u252+9-linux-amd64.tar.gz
    [creator]         Verifying checksum
    [creator]         Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jre
    [creator]         Writing env.launch/JAVA_HOME.override
    [creator]         Writing env.launch/MALLOC_ARENA_MAX.override
    [creator]         Writing profile.d/active-processor-count.sh
    [creator]       Memory Calculator 4.0.0: Contributing to layer
    [creator]         Downloading from https://github.com/cloudfoundry/java-buildpack-memory-calculator/releases/download/v4.0.0/memory-calculator-4.0.0.tgz
    [creator]         Verifying checksum
    [creator]         Expanding to /layers/paketo-buildpacks_bellsoft-liberica/memory-calculator
    [creator]         Writing profile.d/memory-calculator.sh
    [creator]       Class Counter: Contributing to layer
    [creator]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/class-counter
    [creator]       JVMKill Agent 1.16.0: Contributing to layer
    [creator]         Downloading from https://github.com/cloudfoundry/jvmkill/releases/download/v1.16.0.RELEASE/jvmkill-1.16.0-RELEASE.so
    [creator]         Verifying checksum
    [creator]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/jvmkill
    [creator]         Writing env.launch/JAVA_OPTS.append
    [creator]       Link-Local DNS: Contributing to layer
    [creator]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/link-local-dns
    [creator]         Writing profile.d/link-local-dns.sh
    [creator]       Java Security Properties: Contributing to layer
    [creator]         Writing env.launch/JAVA_OPTS.append
    [creator]         Writing env.launch/JAVA_SECURITY_PROPERTIES.override
    [creator]       Security Providers Configurer: Contributing to layer
    [creator]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/security-providers-configurer
    [creator]         Writing profile.d/security-providers-classpath.sh
    [creator]         Writing profile.d/security-providers-configurer.sh
    [creator]       OpenSSL Certificate Loader: Contributing to layer
    [creator]         Copying to /layers/paketo-buildpacks_bellsoft-liberica/openssl-security-provider
    [creator]         Writing profile.d/openssl-certificate-loader.sh
    [creator]     
    [creator]     Paketo Executable JAR Buildpack 1.2.5
    [creator]         Writing env.launch/CLASSPATH
    [creator]       Process types:
    [creator]         executable-jar: java -cp "${CLASSPATH}" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher
    [creator]         task:           java -cp "${CLASSPATH}" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher
    [creator]         web:            java -cp "${CLASSPATH}" ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher
    [creator]     
    [creator]     Paketo Spring Boot Buildpack 1.5.5
    [creator]       Image labels:
    [creator]         org.springframework.boot.spring-configuration-metadata.json
    [creator]         org.springframework.boot.version
    [creator]     ---> EXPORTING
    [creator]     ERROR: failed to create launch cache: removing backup directory '/launch-cache/committed-backup': unlinkat /launch-cache/committed-backup/sha256:476cb0263a8f538fc72cbbe6bcbe70e08129d22a953b966115cb866d942e2b33.tar: permission denied

> Task :bootBuildImage FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootBuildImage'.
> Builder lifecycle 'creator' failed with status code 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 45s
2 actionable tasks: 2 executed

1 个答案:

答案 0 :(得分:0)

这似乎是build cache related(构建缓存已损坏)。您的构建日志显示已使用的构建缓存:

...
 > Executing lifecycle version v0.7.5
 > Using build cache volume 'pack-cache-defc64ac2d6d.build'

由于Spring Boot Gradle插件(与spring-boot-maven-plugin相同)是Paketo.io的抽象,所以它是pack CLI,它使用Docker进行本地构建,因此您应该能够使用以下命令找到构建缓存卷pack-cache-defc64ac2d6d.build

docker volume ls

这给出了类似的内容:

$ docker volume ls
DRIVER    VOLUME NAME
local     bellsoft-jre-config
local     pack-cache-defc64ac2d6d.build
local     pack-cache-defc64ac2d6d.launch
local     spring-cloud-config

现在分别删除构建缓存(docker volume rm pack-cache-defc64ac2d6d.build-或仅通过以下方式删除其他容器未使用的所有本地Docker卷:

docker volume prune

现在您的构建应该再次运行。