I
I
Igor2020-07-17 17:23:17
Flask
Igor, 2020-07-17 17:23:17

Flask won't run from Docker container on localhost, what to do?

Hello, rummaged through the entire network, 4 hours, did not find an answer. I'm running Flask. everything works fine, on any port. And if you pack it in Docker and run it from a container. Does not work, eternal error ERR_EMPTY_RESPONSE.

In the dockerfile, I registered EXPOSE 5000 (I registered both 8000 and 80 and other ports)
In the flask file (I have only 1 file and that's it.) I registered many different ports and did not work at all, it does not help. For example, now it's like this

app.run(port="5000", debug=True)

UPD: Поставил Линукс, проблема осталась


I start the docker with the command docker run --name web -p 5000:5000 web-hello like this
I'm already desperate, it doesn't work. Please help. I have Windows 10.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EvgenySolncev, 2020-07-18
@Pythonist

Try specifying the host address as
host='0.0.0.0' in app.run
Since the flask is trying to listen on an internal interface that cannot be resolved from outside the container,

D
Dmitry Shitskov, 2020-07-17
@Zarom

Looks like a windows problem
https://blog.sixeyed.com/published-ports-on-window...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question