Report this

What is the reason for this report?

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

Posted on April 23, 2020

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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Hi there @sebobill,

I would recommend running the following command:

  1. 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:

  1. 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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.