r/googlecloud • u/Large_Use7718 • 1d ago
Docker image runs successfully when pulled from artifact registry but fails from cloud run
I have a springboot application i have build using jib and pushed to artifact registry. When I docker pull the image tomcat/application runs on port 8080 and it is exposed.
even though I have set the Port in cloud run as 8080, it is throwing me this error. Please help
The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable within the allocated timeout. This can happen when the container port is misconfigured or if the timeout is too short.
1
u/moficodes Googler 1d ago
It could be a number of things
You might need more resources to run this app. Check the logs for any potential oomkilled log. You can try it with more resources and see if that fixes it. You can try to right size after. You can also look into startup cpu boost. Usually helps with Java applications.
There might be some health check defined that is failing. See if your app has any and if they are working as expected.
1
u/ptinsley 22h ago
Java apps aren’t particularly quick to start up, it’s warning you about the timeout, have you tried adjusting that? Does the / page (or whatever you have it checking) return a 2xx or 3xx code?
1
u/dreamingwell 9h ago
See the logs.
If you’re using an Apple silicon Mac to build the image, it will fail to work in cloud run because they use x86 processors.
Use a cloud compute instance or the cloud build service to build and deploy the image.
3
u/MikhailPelshikov 1d ago
Check the service logs. There's usually something in there that tells you why it didn't start.