使用Maven release:perform推容器到ACR时出现tag不存在错误(Quarkus2.15+)
Quarkus 2.15+ 推送镜像到ACR失败问题
问题概述
使用Quarkus和Bitbucket Pipelines两年多,此前运行正常。升级到Quarkus 2.15/2.16版本后,推送容器镜像到Azure Container Registry(ACR)时失败,核心错误信息:
[io.quarkus.deployment.util.ExecUtil] tag does not exist: my-company.azurecr.io/my-app:1.2.30
相关配置
Bitbucket Pipelines完整配置:
image: maven:3.8.7 pipelines: branches: master: - step: size: 2x name: Build and Deploy Artifacts caches: - maven - docker services: - docker script: - git config --global user.email "pipeline@bitbucket.com" - git config --global user.name "Bitbucket Pipeline" - git remote set-url origin ${BITBUCKET_GIT_SSH_ORIGIN} - docker login my-company.azurecr.io -u $AZURE_CLIENT_ID --password $AZURE_SECRET - mvn -B -DdryRun=true release:prepare -Dbitbucket.url=${BITBUCKET_GIT_SSH_ORIGIN} - mvn -B release:clean release:prepare -Dbitbucket.url=${BITBUCKET_GIT_SSH_ORIGIN} -DscmCommentPrefix="[skip ci] " -Darguments="-Dmaven.test.skip=true" - mvn -B release:perform -Dbitbucket.url=${BITBUCKET_GIT_SSH_ORIGIN} -DscmCommentPrefix="[skip ci] " -Darguments="-Dmaven.deploy.skip=true -Dmaven.test.skip=true -Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.push=true -Dquarkus.native.native-image-xmx=4g -Dquarkus.container-image.additional-tags=latest" - git status - git push definitions: services: docker: memory: 7100
完整堆栈跟踪
[INFO] [INFO] [io.quarkus.deployment.util.ExecUtil] tag does not exist: my-company.azurecr.io/my-app:1.2.30 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] [INFO] BUILD FAILURE [INFO] [INFO] ------------------------------------------------------------------------ [INFO] [INFO] Total time: 04:50 min [INFO] [INFO] Finished at: 2023-01-26T10:43:00Z [INFO] [INFO] ------------------------------------------------------------------------ [INFO] [ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.16.0.Final:build (default) on project integration-experian: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [INFO] [ERROR] [error]: Build step io.quarkus.container.image.docker.deployment.DockerProcessor#dockerBuildFromNativeImage threw an exception: java.lang.RuntimeException: Execution of 'docker push $ACR_HELM_REPOinsight.azurecr.io/si-integration-experian:1.2.30' failed. See docker output for more details [INFO] [ERROR] at io.quarkus.container.image.docker.deployment.DockerProcessor.dockerException(DockerProcessor.java:338) [INFO] [ERROR] at io.quarkus.container.image.docker.deployment.DockerProcessor.pushImage(DockerProcessor.java:331) [INFO] [ERROR] at io.quarkus.container.image.docker.deployment.DockerProcessor.lambda$createContainerImage$3(DockerProcessor.java:229) [INFO] [ERROR] at java.base/java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) [INFO] [ERROR] at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735) [INFO] [ERROR] at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) [INFO] [ERROR] at io.quarkus.container.image.docker.deployment.DockerProcessor.createContainerImage(DockerProcessor.java:229) [INFO] [ERROR] at io.quarkus.container.image.docker.deployment.DockerProcessor.dockerBuildFromNativeImage(DockerProcessor.java:153) [INFO] [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) [INFO] [ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [INFO] [ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:568) [INFO] [ERROR] at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909) [INFO] [ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:281) [INFO] [ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) [INFO] [ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) [INFO] [ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) [INFO] [ERROR] at java.base/java.lang.Thread.run(Thread.java:833) [INFO] [ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501) [INFO] [ERROR] -> [Help 1] [INFO] [ERROR] [INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [INFO] [ERROR] [INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles: [INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
解决建议
- 确认镜像是否生成:在
release:perform步骤后添加docker images命令,检查目标镜像my-company.azurecr.io/my-app:1.2.30是否存在。Quarkus 2.15+对原生镜像构建流程有调整,可能存在构建未完成的情况。 - 显式声明镜像构建:在Maven命令中添加
-Dquarkus.container-image.build=true参数,强制Quarkus先完成镜像构建再执行推送。新版本可能需要显式开启构建动作。 - 确保ACR登录有效:
release:perform阶段可能切换环境上下文导致登录失效,可在该命令前重新执行docker login my-company.azurecr.io -u $AZURE_CLIENT_ID --password $AZURE_SECRET。 - 显式指定镜像标签:添加
-Dquarkus.container-image.tag=${project.version}参数,确保Maven Release生成的版本号正确传递给Quarkus容器镜像配置。 - 版本回退验证:暂时回退到Quarkus 2.14版本,确认问题是否消失,排除其他环境因素干扰,定位是否为版本兼容性问题。
内容的提问来源于stack exchange,提问作者Zalo
相关产品推荐
相关产品推荐

