spring-boot:build-image 中出现“请求写入字节超出标头大小”错误

问题描述 投票:0回答:1

我有一个 Spring Boot 项目。当我跑步时

mvnw spring-boot:build-image
它失败并出现以下错误:

[INFO] <<< spring-boot:3.1.12:build-image (default-cli) < package @ perftest <<<
[INFO]
[INFO]
[INFO] --- spring-boot:3.1.12:build-image (default-cli) @ perftest ---
[INFO] Building image 'docker.io/library/perftest:0.0.1-SNAPSHOT'
[INFO]
[INFO]  > Pulling builder image 'gcr.io/paketo-buildpacks/builder:full-cf' 100%
[INFO]  > Pulled builder image 'gcr.io/paketo-buildpacks/builder@sha256:afaf972de6965ff45d2663fe1dc86bd684ccf3c62a2c87a3ad7c2dda9010c295'
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run:full-cnb' 100%
[INFO]  > Pulled run image 'paketobuildpacks/run@sha256:5373ba74412664ac24f132e29b94808467d8522e5f79557d5aea72571c15e7fe'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.702 s
[INFO] Finished at: 2025-01-06T14:30:45+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.1.12:build-image (default-cli) on project perftest: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.1.12:build-image failed: Connection to the Docker daemon at 'localhost' failed with error "Request to write '16384' bytes exceeds size in header of '101246' bytes for entry 'a3c8883a9aacac6989b90547760c0fd13980db4da255df02c67187d1f7fe6b1b.json'"; ensure the Docker daemon is running and accessible -> [Help 1]

我发现,只有当

pom.xml
中的构建器设置为
gcr.io/paketo-buildpacks/builder:full-cf
时才会发生这种情况:

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <image>
                        <builder>gcr.io/paketo-buildpacks/builder:full-cf</builder>
                    </image>
                </configuration>
            </plugin>

如果省略构建器配置,即使用默认构建器,则构建成功。但是我需要将字体包含在目标图像中,所以我使用full-cf构建器。

在我的其他项目中,当从未使用 Spring Boot 3.3.7 时,它的行为是相同的。我收到此错误:

[INFO] <<< spring-boot:3.3.7:build-image (default-cli) < package @ portal <<<
[INFO]
[INFO]
[INFO] --- spring-boot:3.3.7:build-image (default-cli) @ portal ---
[INFO] Building image 'docker.io/library/portal:2025.2-SNAPSHOT'
[INFO]
[INFO]  > Pulling builder image 'gcr.io/paketo-buildpacks/builder:full-cf' 100%
[INFO]  > Pulled builder image 'gcr.io/paketo-buildpacks/builder@sha256:afaf972de6965ff45d2663fe1dc86bd684ccf3c62a2c87a3ad7c2dda9010c295'
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run:full-cnb' 100%
[INFO]  > Pulled run image 'paketobuildpacks/run@sha256:5373ba74412664ac24f132e29b94808467d8522e5f79557d5aea72571c15e7fe'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  24.427 s
[INFO] Finished at: 2025-01-06T14:26:35+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.3.7:build-image (default-cli) on project portal: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.3.7:build-image failed: Connection to the Docker daemon at '//./pipe/docker_engine' failed with error "Request to write '16384' bytes exceeds size in header of '101244' bytes for entry '4ce5e26433d74237ef6e04fbeb92fec672abf398d05f4e81258bb0fbeb510295.json'"; ensure the Docker daemon is running and accessible -> [Help 1]

我正在使用带有 WSL 2 和最新 Docker 的 Windows。 Docker 配置为使用 WSL 2 引擎。

我在另外两个系统上测试了镜像构建,它按预期工作(没有错误)。

知道我的系统出了什么问题吗?

spring-boot docker spring-boot-maven-plugin
1个回答
0
投票

检查您的本地 Docker 实例是否已启动并正在运行。有错误表明它没有在您的本地计算机上运行

Connection to the Docker daemon at 'localhost' failed with error "Request to write '16384' bytes exceeds size in header of '101246' bytes for entry 'a3c8883a9aacac6989b90547760c0fd13980db4da255df02c67187d1f7fe6b1b.json'"; ensure the Docker daemon is running and accessible ```
© www.soinside.com 2019 - 2024. All rights reserved.