Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Running Flask Backend Docker Container in Cloud Shell Always Running on Port 5000 Why?

I have a react application with frontend and backend docker images. I want to deploy the docker container using cloud run. Right now I am trying to get the docker container to run using the Cloud Shell and am first running the backend container. The backend is using Flask and even no matter which port I have specified it automatically uses port 5000 and my application is not able make the api calls to the backend.

1 REPLY 1

Hi @sanjanaj,

Welcome to Google Cloud Community!

I tried replicating your concern and running it using a Docker container in Cloud Shell but the results stay the same, it runs on port 5000 whether I specify a port number or not. This is more likely an intended behavior as explained below.

  • I have found this documentation from Flask that if the port is not provided or set to none, the web server will use port 5000 by default, which seems to be a common default port for development servers.
  • You also mentioned that your application was not able to make API calls to the backend, you might need to create service accounts credentials for your application in order for it to make requests to the APIs.

I hope the above information is helpful.