I am trying to dockerize my flask app. I see that docker will host on 0.0.0.0. But I am not getting it. My dockerfile:
#!/bin/bash
FROM python:3.8
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
EXPOSE 5000
#ENTRYPOINT [ "./main_class.py" ]
#CMD [ "flask", "run", "-h", "0.0.0.0", "-p", "5000" ]
CMD [ "python", "main_class.py", "flask", "run", "-h", "0.0.0.0", "-p", "5000" ]
When I build it , it build successfully. When I run it docker run -p 5000:5000 iris, it ran successfully. It says Running on http://172.17.0.2:5000/ (Press CTRL+C to quit).
Moreover when I see 172.17.0.2:5000 in browser, it does not work. But if I use 127.0.0.1:5000 it works. How can I bring 0.0.0.0:5000 ? In main_class.py I am using
if __name__ == '__main__':
app.run(debug=True, threaded=True, host="0.0.0.0")
When I type docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
90a8a1ee3625 iris "python main_class.p…" 23 minutes ago Up 21 minutes 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp thirsty_lalande
Is there anything wrong I am doing in dockerfile ?
Moreover when I use ENTRYPOINT, it shows me an error standard_init_linux.go:228: exec user process caused: exec format error, thats why I am not using ENTRYPOINT.