The flask host adress in docker run

2019-07-11 04:16发布

I want to run a flask application in Docker, with the flask simple http server. (Not gunicorn)

I got a host setting problem.

In the flask app.py, it should be work as the official tutorial, but it doesn't work:

if __name__ == '__main__':
    app.run(host='0.0.0.0')

So I did it after an answer of a similar post, it suddenly works!:

https://stackoverflow.com/a/43015007/3279996

$> flask run --host=0.0.0.0

My question is why this first method doesn't work, but second works?

0条回答
登录 后发表回答