A software team is deploying an existing internal microservice named `analytics-ingest` to Google Cloud Run using the `gcloud` CLI. The application container is hardcoded to listen for incoming web traffic on port 3000 and does not dynamically adapt to the default `PORT` environment variable. When deployed with default parameters, the service fails health checks because Cloud Run routes requests to port 8080. Which `gcloud run deploy` parameter must be included to resolve this issue?
- A--container-port=3000
- --port=3000Cevap
- C--target-port=3000
- D--trigger-http
Cevap
Use the `--port=3000` flag in the `gcloud run deploy` command to direct Cloud Run to route requests to port 3000 inside the container.
By default, Cloud Run sends requests to port 8080 inside the container and sets the `PORT` environment variable to 8080. If a container application is hardcoded to listen on a non-standard port such as 3000, passing `--port=3000` to `gcloud run deploy` tells Cloud Run to route traffic to port 3000 and sets `PORT=3000` within the container environment.
Adım Adım Çözüm
Anahtar Kavram
Cloud Run Container Port Binding