Question

How do I access a python flask app running in a container on localhost?

Posted April 23, 2020 2.1k views
PythonDockerPython Frameworks

I followed this tutorial on how to build a flask app that runs in docker that can be accessed on localhost and the instructions for building Docker are incorrect because after starting the app, when I visit localhost:6000 there is nothing listening there.

My question is, how do I access the flask app in the Docker container on local host?

https://www.digitalocean.com/community/tutorials/how-to-build-and-deploy-a-flask-application-using-docker-on-ubuntu-18-04

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi there @sebobill,

I would recommend running the following command:

  • docker ps -a

This will show you all of your containers, that way you will be able to see if your container is actually running.

Also if the container is running you will see the port that the container is bound on and try to access it on that specific port.

If the container is not running or if you are still getting the error I would recommend checking your container logs with the following command:

  • docker logs CONTAINER_ID

Feel free to share the output of the two commands here so that I could try to further advise you.

Regards,
Bobby

Submit an Answer