Bird
0
0

After deploying a Cloud Run service, it fails to start and logs indicate the container did not listen on the expected port. What is the most probable cause?

medium📝 Debug Q6 of 15
GCP - Cloud Run
After deploying a Cloud Run service, it fails to start and logs indicate the container did not listen on the expected port. What is the most probable cause?
AThe container does not listen on the port specified by the <code>PORT</code> environment variable.
BThe container image is missing the entrypoint command.
CThe Cloud Run service lacks sufficient CPU allocation.
DThe container is using an unsupported runtime environment.
Step-by-Step Solution
Solution:
  1. Step 1: Understand Cloud Run port requirements

    Cloud Run expects containers to listen on the port defined by the PORT environment variable.
  2. Step 2: Identify cause of failure

    If the container listens on a different port, Cloud Run cannot route traffic, causing startup failure.
  3. Step 3: Eliminate other options

    Missing entrypoint usually causes different errors; CPU allocation issues do not prevent startup; unsupported runtime would cause build or deploy errors.
  4. Final Answer:

    The container does not listen on the port specified by the PORT environment variable. -> Option A
  5. Quick Check:

    Container must listen on $PORT environment variable [OK]
Quick Trick: Container must listen on $PORT environment variable [OK]
Common Mistakes:
  • Ignoring the required listening port
  • Assuming CPU allocation causes startup failure
  • Confusing runtime errors with port issues

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes