A solution architect is deploying a containerized REST API image stored in Artifact Registry to Google Cloud Run in the us-central1 region using the gcloud CLI. The application binary inside the container is configured to listen strictly on container port 5000 and does not dynamically adopt environment variables. The service must be deployed securely, allowing only authenticated requests. Which gcloud CLI command correctly deploys the service with the required network port configuration and ingress access control?
- gcloud run deploy inventory-api --image=us-central1-docker.pkg.dev/my-project/api-repo/inventory:v1 --port=5000 --no-allow-unauthenticated --region=us-central1Answer
- Bgcloud run deploy inventory-api --image=us-central1-docker.pkg.dev/my-project/api-repo/inventory:v1 --no-allow-unauthenticated --region=us-central1
- Cgcloud functions deploy inventory-api --image=us-central1-docker.pkg.dev/my-project/api-repo/inventory:v1 --port=5000 --region=us-central1
- Dgcloud run deploy inventory-api --image=us-central1-docker.pkg.dev/my-project/api-repo/inventory:v1 --port=5000 --allow-unauthenticated --role=roles/owner --region=us-central1
Answer
The command that specifies the custom container listening port using --port=5000, enforces private access via --no-allow-unauthenticated, and targets the us-central1 region with gcloud run deploy is the correct deployment approach.
The command using gcloud run deploy with --port=5000 and --no-allow-unauthenticated correctly informs Cloud Run to forward incoming requests to container port 5000 while ensuring that unauthenticated public traffic is blocked.
Step-by-Step Solution
Key Concept
Cloud Run Container Port Configuration and Ingress IAM Security via gcloud CLI
Estimated Time:2m 0s