'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
Solution 1:[1]
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 (e.g. $REVISION_ID)? Maybe there is a misspelling there?
Cheers, Philmod
Solution 2:[2]
For others who come along, when running into this same issue when pushing a Dockerfile with a Cloud Build YAML file - my mistakes:
- Had ${SHORT_SHA} in one place and not the other (was on the Artifact push and not the build) [https://stackoverflow.com/a/44716934/18176030credit to Philmod for the tag not being right]
- I was using the "grc.io" on during the build process and not the Artifact push (was using "us-east1-docker.pkg.dev").
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Philmod |
| Solution 2 | FreedomLiving |
