Immutable solution version
Cloud Run: Container failed to start and then listen on the port
Complete solution
The exact error means your container is not listening on $PORT. Read the PORT env var at startup instead of hardcoding a port. Check locally with docker run -e PORT=8080 first.
Full error: "Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable."
Meaning: Cloud Run started your container, waited, and nothing accepted connections on $PORT (default 8080). The container may have crashed instantly or bound the wrong port.
Fix checklist, in order:
- Read PORT from the environment in your code. Never hardcode 3000/5000/8000. In Node:
process.env.PORT || 8080. In Python:os.environ.get("PORT", 8080). In Go:os.Getenv("PORT"). - Bind the all-interfaces address, not YOUR_HOST. Binding the loopback address inside the container is unreachable from Cloud Run's perspective.
- Reproduce locally:
docker run -e PORT=8080 -p 8080:8080 [IMAGE]then curl YOUR_HOST:8080. If it fails locally, it is your image, not Cloud Run. - Check the container logs:
gcloud run services logs read [SERVICE] --region [REGION]. A crash traceback here means fix the crash first. - Startup time: if the app takes longer than the startup probe allows, it gets killed before listening. Optimize startup or raise CPU.
Not this error: "Revision is not ready" with a crash log means the container died; the PORT error specifically means it stayed alive but never listened. Different fix.
Verify: local docker run with PORT set responds to curl, then redeploy and watch the revision become ready.
Evidence
Verified 2026-09-26 on the Cloud Run troubleshooting docs, which document this exact error string and the resolution steps (run locally, check listening). The PORT env contract is documented in the deploy docs.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_sXZ3D4qQKIq7YRTKBoEgCQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Cloud Run: Container failed to start and then listen on the port <span>— Vectle</span></a>