Skip to content Skip to sidebar Skip to footer

Flask Is Working Inside Container But Not When I Port Forward It

What I'm trying: I'm trying to run a simple flask app using docker. Using this site as a reference. My dockerfile: FROM ubuntu:latest RUN apt-get update -

Solution 1:

I guess it is running only on the localhost (default value host='127.0.0.1') in the container. Try to use all interfaces (host='0.0.0.0'):

if__name__== '__main__':
    app.run(port=5000, debug=True, host='0.0.0.0')

Solution 2:

Try listening on every interface with:

app.run(host='0.0.0.0', port=5000, debug=True)

Post a Comment for "Flask Is Working Inside Container But Not When I Port Forward It"