Google CloudMid

Cloud Run: container failed to start and listen on PORT

Cloud Run needs your container to listen on the PORT variable on 0.0.0.0. Fix the bind address and port, test the image locally and read the logs.

What you see

  • Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable.

What it means

Cloud Run starts your container and expects it to listen on a port it provides in the PORT environment variable. If the container does not start listening in time, the revision fails.

How to confirm the cause

  1. 1
    Run the same image locally first
    docker run -p 8080:8080 -e PORT=8080 IMAGE

    Google's advice: if it fails locally, fix it locally before you deploy.

  2. 2
    Read the container's logs
    gcloud run services logs read SERVICE_NAME --region REGION

    The docs point to Cloud Logging for stdout and stderr, and to Error Reporting for crashes.

Causes and fixes

  • Wrong port

    HOW TO TELL
    The app listens on a fixed port that is not the value of PORT.
    FIX
    Read PORT from the environment and listen on it.
  • Bound to 127.0.0.1

    HOW TO TELL
    The server listens only on localhost.
    FIX
    Listen on all interfaces, 0.0.0.0. Binding to 127.0.0.1 fails.
  • Wrong architecture

    HOW TO TELL
    The image was built on an ARM machine and misbehaves.
    FIX
    The image must target 64-bit Linux. Build it with Cloud Build instead of on an ARM laptop.

How to stop it coming back

  • Read PORT and bind 0.0.0.0 in every service template.
  • Build images in CI, not on developer machines.

Keep going

Sources

Google Cloud documentation (docs.cloud.google.com), read 18 Nov 2026.

Search

Search cheat sheets and projects