I am trying to source deploy a docker container from a github repo to google cloud run to serve a webapp.
I keep getting a TCP health check error saying “Revision ‘xxxx’ is not ready and cannot serve traffic. The userprovided container failed to start and listen on the port defined provided by the PORT=8000 environment variable within the allocated timeout. This can happen when the container port is misconfigured or if the timeout is too short.”
However, I have my timeouts at the maximum allowed values like so
The container works and exposes the right port in a local run but I can’t figure out why the google run deploy constantly fails. Any ideas on how to address this?
I have also tried adding
ENV HOSTNAME=“0.0.0.0”
ENV HOST=“0.0.0.0”
to my dockerfile as was suggested by some other answers to no avail.
I also pulled down the image built by google cloud using gcloud cli and tested it locally and it seems to start the server and serve the webapp fine.
I’ve been able to confirm that if I run the container on the google cloud engine with the -p 8000:8000 argument I can curl to 0.0.0.0:8000, but if I just did docker run without the -p option then I get no response.
How does google cloud run run the container? It appears that the 8000 port that I picked in the configuration console is not getting used to route requests to the container port.
Just wanted to jump into the thread. Could you check if changing the port to 8080 helps? From the Container runtime contract, Cloud Run requests are sent to port 8080 by default.
Since you’ve already verified that your container works locally, another troubleshooting step I can suggest is to confirm that your container image is compiled for 64-bit Linux as required by the container runtime contract.
Another option we can try is to run a Connectivity Test and then share your test results here. I also found this thread on Stack Overflow where the user was able to resolve their container issue by doing a Startup Probe healthcheck.
Was my response helpful? If so, feel free to accept this answer as “Solution”. If you need any additional assistance you may also reply here within two business days. Share your logs, screenshots, or any additional errors you might have received and I’ll be happy to help.
@Rhett Thanks for the suggestions. I am using google cloud build (deploying from source from repo on github) so the platform should not be an issue (I tried having both FROM --platform=linux/amd64 julia:latest and FROM julia:latest in my dockerfile)
Also I thought that choosing the port as 8000 overrides the default port of 8080. I’ve
I am having the same issue, I am trying to deploy a new image of the same codebase that was working one month ago (no app or build changes made) to test it and I get the same error.
comparing the yaml files, these are the main diffs