I have a Flask app that runs without errors if I run python app.py locally. It says Running on http://127.0.0.1:5000, and if I just go to http://127.0.0.1:5000, everything works like it's supposed to. The last line of app.py is app.run(debug=True).
Now I'm trying to run this app using Docker. In my Dockerfile, one of the lines is EXPOSE 8501.
I then build the image with docker build -t testimage .
Finally I execute docker run -it --expose=8501 -p 8501:8501 testimage, and again it says Running on http://127.0.0.1:5000.
My questions is :what do I have to enter in my browser to access the app that is running inside the Docker container?
You're exposing port 8501, but still run the flask app on port 5000. You should either start the app on exposed port (you can do that using
portargument toapp.run) or expose a different port when running docker, matching the one app runs on.