Search code examples
google-cloud-platformgcloudgoogle-cloud-run

When using 'gcloud run deploy', how can I specify the service name with command line args?


When using gcloud run deploy, how can I specify the service name with command-line args? I'm hoping to prevent the need for interactivity at deploy-time.

I'm currently deploying my service like so:

gcloud run deploy --image gcr.io/<PROJECT>/<TAG> --platform managed

Solution

  • There is a service parameter, which is positional as opposed to named.

    From the docs:

    gcloud run deploy [[SERVICE] --namespace=NAMESPACE] etc...
    

    So you could do this:

    gcloud run deploy <SERVICE_NAME> --image gcr.io/<PROJECT>/<TAG> --platform managed
    

    https://cloud.google.com/sdk/gcloud/reference/run/deploy#POSITIONAL-ARGUMENTS