Cloud Run: "Failed to start and then listen on the port defined by the PORT environment variable." When I use 8080
I got this error message when I try to run my container in Google Cloud Run. type: Ready status: 'False' reason: HealthCheckContainerError message: |- Cloud 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. I already checked the followings but nothing helped to me: https://cloud.google.com/run/docs/troubleshooting Cloud Run error: Container failed to start My container is running locally and it's listening on default PORT 8080 with HOST configured as 0.0.0.0. My Dockerfile: FROM node:10 WORKDIR /usr/src/app ENV PORT 8080 ENV HOST 0.0.0.0 COPY package*.json ./ RUN npm install --only=production COPY . . RUN npm run build CMD npm start Any idea on why Cloud Run keeps failing to listen on the port? Project GitHub repo: https://github.com/fodorpapbalazsdev/ssr-app
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. tl;dr build your Docker container with the --platform linux/amd64 flag before deploying the image to Cloud Run ======================================================== Long story: Aside 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. GCP 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. I guess that explains why building the image on Cloud Build works from the other answer in this post.
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/3f668911805c29118f21b32b3782191b67a52191534e0582fa64e6eca701c06f