David
David

Reputation: 2991

invalid image name in cloud build when using domain-scoped project

I'm trying to build a container with GCP's Cloud Build. I'm using the simple template from the quickstart doc. I've done this before successfully.

However, this time I am using a project which is under an "organization". So the project ID is mycompany.com:projectX, rather than simply projectX.

I am unable to get the build to complete.

When I run:

gcloud builds submit --tag gcr.io/mycompany.com:project-id/helloworld

I get the following error:

(gcloud.builds.submit) INVALID_ARGUMENT: invalid build: invalid image name "gcr.io/mycompany.com:projectX/helloworld" 

I suspect that since the --tag flag calls docker build -t $TAG . under the hood and docker image names use : to specify versions, this format may be invalid.

Any ideas what I am supposed to do when working with organization projects? I cannot find relevant info in the Cloud Build or GCP IAM docs.

Some things I've tried:

Upvotes: 6

Views: 12104

Answers (3)

abutir
abutir

Reputation: 81

for anyone stumbling to figure out how to solve this error :

Your build failed to run: generic::invalid_argument: invalid build: invalid image name .. etc

this error accured after i deployed my app to cloud run through github . simply do the following steps :

  1. go to your triggers in cloud build
  2. navigate down to configuration then click open editor
  3. replace the path set automatically with your path from the error log , but make it small letters , and do not allow it to be more than 100 char

Upvotes: 0

James
James

Reputation: 499

You need to replace the ":" with a "/"

gcloud builds submit --tag gcr.io/mycompany.com/project-id/helloworld

More info can be found here: https://cloud.google.com/container-registry/docs/overview#domain-scoped_projects

Upvotes: 7

Soni Sol
Soni Sol

Reputation: 2612

you can do it by running:

gcloud beta run deploy --image gcr.io/replica-20584682/helloworld --platform managed

now all the projects are under an organization by default and the project id is unique globally here its explained this.

As it is unique globally while deploying you don't need to mention the organization.

EDIT added the flag --platform managed

Upvotes: 0

Related Questions