简体   繁体   中英

Docker image fails to build on Google Container Registry

I have setup a trigger from Bitbucket to Google Container Registry. I have a Dockerfile in the root, and am able to build the container fine from my local machine.

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). My project name has been replaced with "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? If so do you use some substitutions variables (eg $REVISION_ID )? Maybe there is a misspelling there?

Cheers, Philmod

For others who come along, when running into this same issue when pushing a Dockerfile with a Cloud Build YAML file - my mistakes:

  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]
  2. I was using the "grc.io" on during the build process and not the Artifact push (was using "us-east1-docker.pkg.dev").

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM