gcloud run deploy: Ship to Cloud Run in CI
Deploy a container image or source directory to a Cloud Run service.
gcloud run deploy creates or updates a Cloud Run service from a prebuilt image or directly from source. In CI you typically build and push an image first, then deploy it by digest or tag. Flags control region, auth, scaling, and environment.
Common flags
SERVICE- the service name (positional)--image=IMAGE- container image to deploy--region=REGION- required unless run/region is configured--allow-unauthenticated- make the service public--set-env-vars=KEY=VALUE- set environment variables
Example in CI
Deploy an image built earlier in the pipeline.
shell
gcloud run deploy api \
--image=us-central1-docker.pkg.dev/my-project/repo/api:${GITHUB_SHA} \
--region=us-central1 \
--platform=managed \
--quietCommon errors in CI
- Revision is not ready and cannot serve traffic - container failed to start or did not listen on $PORT
- PERMISSION_DENIED: ... run.services.create - SA missing roles/run.admin
- Image not found - wrong digest/tag or the push step did not complete
Key takeaways
- Deploys an image or source to Cloud Run and shifts traffic to the new revision.
- Always pass --region (or configure it) and --quiet for non-interactive runs.
- Most failures are a container that does not listen on $PORT or a missing run.admin role.
Related guides
gcloud builds submit: Build with Cloud Build in CISubmit a build to Cloud Build from CI: key flags for tag and config, a pipeline example, and the build errors…
gcloud auth configure-docker: Push Images in CIConfigure Docker to authenticate to Artifact Registry and GCR via gcloud: flags, a CI example, and the auth e…
gcloud secrets versions access: Read Secrets in CIRead a Secret Manager secret value from a pipeline: required arguments, a CI example, and the access errors y…