An enterprise migration team has packaged an multi-endpoint REST microservice into a custom container image named `gcr.io/my-project/orders-api:v1`. The web server inside the container is explicitly compiled to listen on internal TCP port `3000` rather than reading standard environment defaults. The deployment requirements mandate using a serverless execution model with a custom identity service account (`[email protected]`) for fine-grained GCP resource access, while allowing unauthenticated public HTTPS ingress. Which `gcloud` command must a Cloud Engineer execute to successfully deploy this application to Cloud Run?
- gcloud run deploy orders-api --image=gcr.io/my-project/orders-api:v1 --port=3000 --service-account=orders-identity@my-project.iam.gserviceaccount.com --allow-unauthenticated --region=us-central1Answer
- Bgcloud functions deploy orders-api --image=gcr.io/my-project/orders-api:v1 --port=3000 --service-account=orders-identity@my-project.iam.gserviceaccount.com --allow-unauthenticated --region=us-central1
- Cgcloud run deploy orders-api --image=gcr.io/my-project/orders-api:v1 --service-account=orders-identity@my-project.iam.gserviceaccount.com --allow-unauthenticated --region=us-central1
- Dgcloud run deploy orders-api --image=gcr.io/my-project/orders-api:v1 --port=3000 --role=roles/owner --allow-unauthenticated --region=us-central1
Answer
The command starting with `gcloud run deploy orders-api --image=gcr.io/my-project/orders-api:v1 --port=3000` correctly provisions a Cloud Run service listening on internal port 3000 with the specified runtime service account and unauthenticated access.
Deploying a containerized web application listening on custom port 3000 requires `gcloud run deploy` combined with `--port=3000`, `--service-account`, and `--allow-unauthenticated`. This ensures correct traffic forwarding, appropriate identity management, and public ingress access.
Step-by-Step Solution
Key Concept
Cloud Run Container Port Contract and Identity Deployment Flags
Estimated Time:2m 0s