You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Spring Boot Maven插件构建镜像时因GCR权限不足导致GitHub Actions构建失败求助

Spring Boot Maven插件构建镜像时因GCR权限不足导致GitHub Actions构建失败求助

各位好,我遇到了一个棘手的问题:我的项目之前用GitHub Actions构建一直很顺利,但最近突然失败了,报错是拉取GCR上的Paketo构建器镜像时权限不足。

具体的错误栈信息如下:

Caused by: org.springframework.boot.buildpack.platform.docker.transport.DockerEngineException: Docker API call to 'localhost/v1.24/images/create?fromImage=gcr.io%2Fpaketo-buildpacks%2Fbuilder%3Abase-platform-api-0.3' failed with status code 500 "Internal Server Error" and message "Head "https://gcr.io/v2/paketo-buildpacks/builder/manifests/base-platform-api-0.3": denied: Caller does not have permission or the resource may not exist 'read'. To configure permissions, follow instructions at: https://cloud.google.com/container-registry/docs/access-control"
	at org.springframework.boot.buildpack.platform.docker.transport.HttpClientTransport.execute (HttpClientTransport.java:135)
	at org.springframework.boot.buildpack.platform.docker.transport.HttpClientTransport.post (HttpClientTransport.java:82)
	at org.springframework.boot.buildpack.platform.docker.DockerApi$ImageApi.pull (DockerApi.java:155)
	at org.springframework.boot.buildpack.platform.build.Builder.pullBuilder (Builder.java:82)
	at org.springframework.boot.buildpack.platform.build.Builder.build (Builder.java:63)
	at org.springframework.boot.maven.BuildImageMojo.buildImage (BuildImageMojo.java:189)
	at org.springframework.boot.maven.BuildImageMojo.execute (BuildImageMojo.java:181)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
	at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
	at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
	at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)

我的GitHub Actions workflow里相关的构建步骤是这样的:

- name: Build Layered Jar with Maven
  run: mvn clean install spring-boot:build-image -e -B -U --file pom.xml -P test -s src/main/resources/settings.xml

我有点困惑,之前构建完全没问题,为什么突然就出现权限拒绝了?有没有可能是GCR上这个镜像的权限设置变了?或者GitHub Actions的默认runner访问GCR的策略有更新?有没有大佬遇到过类似问题,能给点排查方向或者解决办法吗?

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.07 07:38:03