I'm a beginner in docker and I have a folder called MovieFlix
that contains a flask web service
app with some html templates
that I connect to a mongodb image from docker
. I want to run my flask app as a docker image . For that I have succesfully created a DockerFile
which I list below :
FROM ubuntu:16.04
MAINTAINER bill <bill@gmailcom>
RUN apt-get update
RUN apt-get install -y python3 python3-pip
RUN pip3 install flask pymongo flask_bcrypt
EXPOSE 80
WORKDIR "/MovieFlix"
COPY webservice.py . //copy the flask app i want to run
COPY templates . //copy my html templates
CMD ["python3", "webservice.py", "--host", "0.0.0.0", "--port", "80"]
My image is built succesfully however when I run docker -p 5000:80 flask(my image name )
and copy the url http://127.0.0.1:5000/
in my search engine I get that the page does not work and 127.0.0.1 did not send data
I can run my webservice.py
normally on vscode and the mongodb image is running so I do not think the problem is there and I run my flask app with
if __name__ == '__main__':
app.run(debug=True, host='127.0.0.1', port=5000)
I would appreciate your help with guiding me to solve this issue . Thank you in advance .