Inserm-IST / MTW-MeSH-Docker

Docker Compose file to manage the build and deployment of MTW-MeSH
1 stars 0 forks source link

Stop listening on all interfaces via 0.0.0.0 #1

Open JulienBacquart opened 1 month ago

JulienBacquart commented 1 month ago

See: https://stackoverflow.com/questions/30323224/deploying-a-minimal-flask-app-in-docker-server-connection-issues/58138250#58138250

filak commented 1 month ago

Hi @JulienBacquart, thank you for working on the Docker image !

None of the MTW servers listens on 0.0.0.0 by default - please see https://github.com/filak/MTW-MeSH/blob/master/flask-app/mtw-server.py - the default is always localhost/127.0.0.1

And you can override this using the --host param when launching the server process.

JulienBacquart commented 1 month ago

Hi @filak ,

That's exactly what I'm doing, in the Compose file I have to run MTW with the following command:

python mtw-server.py --host 0.0.0.0 $${DEBUG} & python mtw-worker.py $${DEBUG}

This is because of the behavior of Docker and Flask, If the MTW server listen to localhost, it's actually listening to the localhost of the container, not the local machine. So you can't access the server from the local machine. So I have to have the server listening on all interfaces, to be able to reach it. But I'm not super comfortable with the idea. There is a solution it seems, see the SO topic I posted, but I don't know if it's super portable to specify the IP address of the Docker container network interface, I need to do some tests.