{"id":536,"hash":"3f668911805c29118f21b32b3782191b67a52191534e0582fa64e6eca701c06f","pattern":"Cloud Run: &quot;Failed to start and then listen on the port defined by the PORT environment variable.&quot; When I use 8080","full_message":"I got this error message when I try to run my container in Google Cloud Run.\n\ntype: Ready\nstatus: 'False'\nreason: HealthCheckContainerError\nmessage: |-\nCloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.\n\nI already checked the followings but nothing helped to me:\n\nhttps://cloud.google.com/run/docs/troubleshooting\n\nCloud Run error: Container failed to start\n\nMy container is running locally and it's listening on default PORT 8080 with HOST configured as 0.0.0.0.\n\nMy Dockerfile:\n\nFROM node:10\n\nWORKDIR /usr/src/app\n\nENV PORT 8080\nENV HOST 0.0.0.0\n\nCOPY package*.json ./\n\nRUN npm install --only=production\n\nCOPY . .\n\nRUN npm run build\n\nCMD npm start\n\nAny idea on why Cloud Run keeps failing to listen on the port?\n\nProject GitHub repo:\n\nhttps://github.com/fodorpapbalazsdev/ssr-app","ecosystem":"npm","package_name":"google-cloud-platform","package_version":null,"solution":"Just to check, are you using the M1 Macbook? I found a solution for myself after facing this issue for some time, might not be the solution for you but just to share some insights I found for other MacBook users.\n\ntl;dr\n\nbuild your Docker container with the --platform linux/amd64 flag before deploying the image to Cloud Run\n\n========================================================\n\nLong story:\n\nAside from the container failed to start and listen to the $PORT error, my logs were showing the following: Application failed to start: Failed to create init process: failed to load /usr/local/bin/npm: exec format error. Upon some digging, one of the reasons this happens is that we are trying to run an arm64 image (built on M1 MacBook) on a different host platform.\n\nGCP does mention on this page here that Executables in the container image must be compiled for Linux 64-bit. Cloud Run specifically supports the Linux x86_64 ABI format.\n\nI guess that explains why building the image on Cloud Build works from the other answer in this post.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/66127933/cloud-run-failed-to-start-and-then-listen-on-the-port-defined-by-the-port-envi","votes":45,"created_at":"2026-04-19T04:51:19.424808+00:00","updated_at":"2026-04-19T04:51:19.424808+00:00"}