A developer is deploying a stateless containerized web application to Google Cloud Run using the gcloud CLI. The application must be publicly accessible over HTTP without requiring authentication. Which TWO configuration steps or practices must be implemented to ensure the deployment succeeds and is publicly accessible? (Select TWO.)
- Pass the --allow-unauthenticated flag during deployment (or grant the Cloud Run Invoker role to allUsers) to permit public access.Answer
- Ensure the containerized application listens for incoming HTTP requests on the port specified by the PORT environment variable.Answer
- CGrant the primitive Owner role (roles/owner) to allUsers on the Cloud Run service resource.
- DHardcode the application container to listen strictly on HTTPS port 443 inside the Dockerfile.
Answer
To successfully deploy a public Cloud Run service, you must allow unauthenticated invocations by passing the --allow-unauthenticated flag (or granting roles/run.invoker to allUsers) and ensure the containerized web app listens on the port defined by the PORT environment variable.
Deploying a public Cloud Run service requires fulfilling both the container contract and IAM ingress settings: the application must listen on the port injected via the PORT environment variable (default 8080), and unauthenticated access must be enabled either with the --allow-unauthenticated deployment flag or by assigning the Cloud Run Invoker role (roles/run.invoker) to allUsers.
Step-by-Step Solution
Key Concept
Cloud Run Container Contract and Public Access IAM Binding