An application developer needs to deploy a stateless HTTP web service named report-generator packaged as a container image to Google Cloud Run in the us-east1 region. The containerized application is built to listen on the port defined by the standard PORT environment variable injected by the Cloud Run container runtime at startup. Which command should the developer execute to deploy this container image from Artifact Registry to Cloud Run while adhering to Google Cloud serverless best practices?
- gcloud run deploy report-generator --image=us-east1-docker.pkg.dev/my-project/apps/report-generator:v1 --region=us-east1Cevap
- Bgcloud run deploy report-generator --image=us-east1-docker.pkg.dev/my-project/apps/report-generator:v1 --region=us-east1 --set-env-vars=PORT=80
- Cgcloud functions deploy report-generator --image=us-east1-docker.pkg.dev/my-project/apps/report-generator:v1 --region=us-east1 --trigger-http
- Dgcloud run deploy report-generator --image=us-east1-docker.pkg.dev/my-project/apps/report-generator:v1 --region=us-east1 --service-account=project-owner@my-project.iam.gserviceaccount.com
Cevap
Execute the standard gcloud run deploy command specifying the service name, container image path in Artifact Registry, and target region.
The correct command uses `gcloud run deploy` to specify the service name, container image from Artifact Registry, and target region. Cloud Run automatically injects the `PORT` environment variable (defaulting to 8080) into the container container environment, allowing the application to start receiving HTTP requests cleanly without requiring custom port environment variable overrides.
Adım Adım Çözüm
Anahtar Kavram
Cloud Run Container Deployment and Port Binding Rules