A developer has packaged a web microservice into a custom container image. The internal web server inside the container is configured to listen strictly on port 8000. When deploying this container image to Google Cloud Run using the gcloud CLI, which command flag must be included to ensure Cloud Run correctly routes incoming HTTP requests to the application?
- Pass the --port=8000 flag during the gcloud run deploy execution.Cevap
- BDeploy the application to Cloud Functions Gen 2 instead, which automatically detects and exposes custom internal listener ports.
- CSet an environment variable PORT=8080 in the container configuration without altering the application's internal listener port of 8000.
- DGrant the deployment service account the Owner primitive role so Cloud Run can inspect and bind to open container ports dynamically.
Cevap
Pass the --port=8000 flag during the gcloud run deploy execution.
By default, Cloud Run sends ingress requests to port 8080 inside the container. Supplying the --port=8000 flag during deployment configures Cloud Run to direct ingress traffic to port 8000, aligning with the application's internal listener port.
Adım Adım Çözüm
Anahtar Kavram
Cloud Run Custom Container Port Configuration