I have a flask app (Dash plotly) and I want to run it on Docker. I did the following things on Linux and it ran successfully:
app.run_server(debug=True, host='0.0.0.0')
EXPOSE 8050
CMD ["python", "./app.py"]
sudo docker build -t app.
sudo docker run -p 8050:8050 --mount type=bind,source=/,target=/tmp app
It provided me the url: 0.0.0.0.8050, and it's works fine.
However, when I downloaded Docker Toolbox on windows 10 and Did exactly the same steps it didn't launch the app on the url that was provided.
Anyone know what's the problem?
It's because docker isn't running natively on Windows. It's running on a virtual Linux machine on Windows. So, instead of using the 0.0.0.0
, you have to check the IP of the toolbox by using:
docker-machine ls
And then replace 0.0.0.0
with the that ip
Update:
If you want to use the host network, you can use the host mode by --network
host. But please note that port forward will not work.
reference:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.