Docker Python Flask Gets " Do You Want To Continue" Then "executor Failed"
Solution 1:
You should change the RUN
lines in the Dockerfile with apt-get
in them to use the -y
flag to skip asking you to confirm "yes".
The Dockerfile in the tutorial actually seems out of date or has errors in it. You need to use pip3
now to install Flask
and also include the -y
flag in your apt-get
commands. I edited the Dockerfile from the tutorial and posted below:
FROM ubuntu
RUN apt-getupdate-y && \
apt-get install -y python3-pip && \
pip3 install Flask
COPY app.py /
WORKDIR /
EXPOSE 5000
CMD ["python3","app.py"]
EDIT To fix the connection issues on Windows from this answer, you can fix this by changing the main function in the Python app from:
if __name__ == '__main__':
app.run()
to this:
if __name__ == '__main__':
app.run('0.0.0.0')
The reason is that you need Flask to bind to 0.0.0.0
instead of the localhost interface in the container, otherwise, it won't forward outside the container. After fixing that, you should be able to access the app at localhost:5000
on your host machine.
Post a Comment for "Docker Python Flask Gets " Do You Want To Continue" Then "executor Failed""