0

I am using Google Cloud and I am trying to deploy this repository.

This is the docker-compose.prod.yml And the Dockerfile

Everything goes perfect: the build stage is finish without any error.

But the problem appears on the deploying stage: I get this error:

The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information

I am new to Docker. I don't know where the port 8080 is being defined from the application.

Does anyone knows when in my docker files is this defined or how can I fix this error and deploy the application.

I have tried:

  1. gcloud run deploy ds-creative --source .
  2. gcloud run deploy ds-creative --source . --port=8080
  3. Creating a Cloud Run service from a GitHub repository.
  4. Creating a firewall rule to open port 8080

And in all of them I get the same error.

Thanks

ivantxo
  • 719
  • 5
  • 18
  • 36

1 Answers1

0

Based on this documentation on troubleshooting Cloud Run issues, you need to rule out potential causes first:

  1. Verify that you can run your container image locally.

  2. Check if your container is listening for requests on the expected port as documented in the container runtime contract. Your container must listen for incoming requests on the port that is defined by Cloud Run and provided in the PORT environment variable. See Configuring containers for instructions on how to specify the port.

  3. Check if your container is listening on all network interfaces, commonly denoted as 0.0.0.0.

  4. Verify that your container image is compiled for 64-bit Linux as required by the container runtime contract.

    • Note: If you build your container image on a ARM based machine, then it might not work as expected when used with Cloud Run. To solve this issue, build your image using Cloud Build.
  5. Use Cloud Logging to look for application errors in stdout or stderr logs. You can also look for crashes captured in Error Reporting.

    You might need to update your code or your revision settings to fix errors or crashes. You can also troubleshoot your service locally.

You can also check this similar stackoverflow question.

Robert G
  • 1,583
  • 3
  • 13