Search code examples
command-line-interfacegcloudgoogle-cloud-run

"gcloud run deploy" vs "gcloud run services update"


What is the difference between these two commands when used to update a service? Is there a reason to prefer one over the other?

https://cloud.google.com/sdk/gcloud/reference/run/deploy https://cloud.google.com/sdk/gcloud/reference/run/services/update

Only major difference I've spotted is services update lacks the --source flag and doesn't require you to specify --image.


Solution

  • gcloud run deploy is used to create or update a Cloud Run service. And it is sort of a combo command. If you have source code instead of a built image, it'll invoke Cloud Build to build your image, then it'll invoke services update, and then it'll optionally add-iam-policy-binding to allow unauthenticated users.

    If all you need is to update a Cloud Run service with an already built image, then you can use gcloud run services update, which will update Cloud Run environment variables and other configuration settings.