DEV Community

Ryo Kuroyanagi
Ryo Kuroyanagi

Posted on

[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 !

Top comments (0)