首页 > 解决方案 > 无法在 Windows 上连接到 Docker 上的 Flask 应用程序

问题描述

我有一个烧瓶应用程序(Dash plotly),我想在 Docker 上运行它。我在 Linux 上做了以下事情并成功运行:

它为我提供了 url:0.0.0.0.8050,它工作正常。

但是,当我在 Windows 10 上下载 Docker Toolbox 并执行完全相同的步骤时,它并没有在提供的 url 上启动应用程序。

有谁知道是什么问题?

标签: pythondockerflaskplotly-dashdocker-network

解决方案


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:

https://docs.docker.com/network/network-tutorial-host/


推荐阅读