How to run Python Flask within a Docker container [duplicate] How to run Python Flask within a Docker container [duplicate] flask flask

How to run Python Flask within a Docker container [duplicate]


Try app.run(host='0.0.0.0').

By default, Flask server is only accessible from the localhost. In your case, the container is the localhost, and your requests are originating from outside the container. host='0.0.0.0' parameter makes the server accessible from external IPs. It's described in Flask documentation in detail.