DEV Community

Ryo Kuroyanagi
Ryo Kuroyanagi

Posted on

3 1

[Cloud Build] Failed to trigger build: generic::invalid_argument: invalid build: invalid image name

TL;DR If you see the error message in this article title when you run Cloud Build trigger, the Docker image name is too long to handle for GCP.

Image description

Details

The default inline cloudbuild.yaml which is auto-generated when we create Cloud Run service, defines docker image names as like the following.

$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA
Enter fullscreen mode Exit fullscreen mode

However, the image name can be so long like

asia.gcr.io/your-long-project-id/repository-name/service-name:87caefacca50d6d64288732070b522a92690dde0
Enter fullscreen mode Exit fullscreen mode

Seems like GCP has the limit for handling Docker image name and it is 100 characters at max. So, if the default definition does not work for your case, you can remove an element from the template like $REPO_NAME. If the Docker image name gets shorter than 100, the build pipeline should work.

Hope this shorten your debug time !

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

AWS GenAI Live!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️