简体   繁体   English

Docker 图像无法在 Google Container Registry 上构建

[英]Docker image fails to build on Google Container Registry

I have setup a trigger from Bitbucket to Google Container Registry.我已经设置了一个从 Bitbucket 到 Google Container Registry 的触发器。 I have a Dockerfile in the root, and am able to build the container fine from my local machine.我在 root 中有一个 Dockerfile,并且能够从我的本地机器上很好地构建容器。

I get this error in Google Container Registry when the trigger runs (I did not modify the command that GCR wanted to run - it's the default).当触发器运行时,我在 Google Container Registry 中收到此错误(我没有修改 GCR 想要运行的命令 - 这是默认设置)。 My project name has been replaced with "project":我的项目名称已替换为“project”:

FETCHSOURCE
Initialized empty Git repository in /workspace/.git/
From https://source.developers.google.com/p/project/r/bitbucket-project-gateway
* branch c65f16b3f52262a047c71e7140aecc4300265497 -> FETCH_HEAD
HEAD is now at c65f16b testing
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
invalid argument "gcr.io/project/bitbucket-project-gateway:" for t: invalid reference format
See 'docker build --help'.
ERROR
ERROR: build step "gcr.io/cloud-builders/docker@sha256:e576df764ae28d3c072019a235b6c8966df11eecb472c59b0963d783bb8a713b" failed: exit status 125

It looks like the image's tag is missing (after the ":"). 看起来图像的标签丢失了(在“:”之后)。

Do you have a cloudbuild.yaml config file? 你有cloudbuild.yaml配置文件吗? If so do you use some substitutions variables (eg $REVISION_ID )? 如果是这样,你使用一些替换变量(例如$REVISION_ID )? Maybe there is a misspelling there? 也许那里有拼写错误?

Cheers, Philmod 干杯,Philmod

For others who come along, when running into this same issue when pushing a Dockerfile with a Cloud Build YAML file - my mistakes:对于其他人,在使用 Cloud Build YAML 文件推送 Dockerfile 时遇到同样的问题 - 我的错误:

  1. Had ${SHORT_SHA} in one place and not the other (was on the Artifact push and not the build) [ https://stackoverflow.com/a/44716934/18176030 credit to Philmod for the tag not being right]在一个地方有 ${SHORT_SHA} 而不是另一个地方(在 Artifact 推送上而不是构建上)[ https://stackoverflow.com/a/44716934/18176030由于标签不正确而归功于 Philmod]
  2. I was using the "grc.io" on during the build process and not the Artifact push (was using "us-east1-docker.pkg.dev").我在构建过程中使用了“grc.io”,而不是 Artifact 推送(使用的是“us-east1-docker.pkg.dev”)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 Docker 映像从 GKE 中运行的容器推送到 Google Container Registry - Push a Docker image to Google Container Registry from a container running in the GKE 从GCR导出Docker镜像(Google容器注册表) - Export Docker image from GCR (Google Container Registry) 无法将Docker镜像从Google Container Registry中拉入Kubernetes Pod - Unable to pull docker image into Kubernetes Pod from Google Container Registry Docker SDK 与 Google 容器注册表 - Docker SDK with Google Container Registry 将 Docker 镜像推送到 Container Registry - Pushing the Docker image to Container Registry 我可以使用Google Cloud build中的Docker映像注册表吗? - Can I use docker image registry from google cloud build? Google Cloud Build for Python app triggered docker build fails to pull pip requirement from private artefact registry - Google Cloud Build for Python app triggered docker build fails to pull pip requirement from private artefact registry 使用最少的依赖项/权限将 Docker 容器镜像镜像到 Google Container Registry - Mirror Docker container image to Google Container Registry using least dependencies/permissions Docker 无法将图像推送到 Google Cloud Registry - Docker fails to push images to Google Cloud Registry 从Google Cloud Container Registry中提取Docker映像时权限被拒绝 - Permission denied when pulling Docker image from Google Cloud Container Registry
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM