Windows + Docker + Port not exposed/reachable Windows + Docker + Port not exposed/reachable windows windows

Windows + Docker + Port not exposed/reachable


You need to set the app to run on host='0.0.0.0'. That is:

app.run(host='0.0.0.0')

So when you run:

> docker run -d -p 5000:5000 simple-flask-app --name simple-flask-app* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)* Restarting with stat

Then curl http://localhost:5000 works.

Credit goes to:https://codefresh.io/docker-tutorial/hello-whale-getting-started-docker-flask/


For me, the simplest solution was to run:

docker-machine ip default

This prints an IP address. In my case, this IP is not shown by ipconfig.I tested with Docker 18.03.0-ce on a Windows 7 Host.

I found this tip here: https://www.jhipster.tech/tips/020_tip_using_docker_containers_as_localhost_on_mac_and_windows.html


I just changed the order of the name parameter and it worked (in Linux).

docker run -d -p 5000:5000 --name simple-flask-app simple-flask-app