Docker 图像不在主机 8050 上 运行
Docker image not running on host 8050
我正在尝试自学如何在 AWS 上部署 dash 应用程序。
我在我的 mac 上创建了一个文件夹 'DashboardImage',其中包含一个 Dockerfile、README.md、requirements.txt 和一个包含我的 python 的应用程序文件夹破折号应用程序 'dashboard.py'.
我的 Dockerfile 如下所示:
我进入 DashboardImage 文件夹 运行
docker built -t conjoint_dashboard .
构建成功,如果我 运行 docker 图片我可以看到图片的细节。
当我尝试时
docker run conjoint_dashboard
终端告诉我 Dash 运行正在 http://0.0.0.0:8050/ 上,但它没有连接。
我不明白为什么。
需要暴露端口,见:https://docs.docker.com/engine/reference/commandline/run/#publish-or-expose-port--p---expose
$ docker run -p 127.0.0.1:80:8080/tcp ubuntu bash
This binds port 8080 of the container to TCP port 80 on 127.0.0.1 of the host machine. You can also specify udp and sctp ports. The Docker User Guide explains in detail how to manipulate ports in Docker.
根据您的端口更新它,例如如果您的应用程序公开端口 8050
那么:
docker run -p 8050:8050 conjoint_dashboard
其中 -p = publish first one is the HOST port, and the second is the CONTAINER port.
您还可以更新您的 docker 文件:
FROM: continuumio/minicoda3
...
EXPOSE 8050/tcp
...
EXPOSE
指令实际上并不是 publish
端口。它作为构建映像的人和运行容器的人之间的一种文档,关于要发布哪些端口。
要在 运行 容器时实际发布端口,请在 docker 运行 上使用 -p
标志发布并映射一个或多个端口,或者 -P
标志发布所有暴露的端口并将它们映射到高阶端口。
默认情况下,EXPOSE 假定 TCP。您还可以指定 UDP:
我正在尝试自学如何在 AWS 上部署 dash 应用程序。
我在我的 mac 上创建了一个文件夹 'DashboardImage',其中包含一个 Dockerfile、README.md、requirements.txt 和一个包含我的 python 的应用程序文件夹破折号应用程序 'dashboard.py'.
我的 Dockerfile 如下所示:
我进入 DashboardImage 文件夹 运行
docker built -t conjoint_dashboard .
构建成功,如果我 运行 docker 图片我可以看到图片的细节。
当我尝试时
docker run conjoint_dashboard
终端告诉我 Dash 运行正在 http://0.0.0.0:8050/ 上,但它没有连接。
我不明白为什么。
需要暴露端口,见:https://docs.docker.com/engine/reference/commandline/run/#publish-or-expose-port--p---expose
$ docker run -p 127.0.0.1:80:8080/tcp ubuntu bash
This binds port 8080 of the container to TCP port 80 on 127.0.0.1 of the host machine. You can also specify udp and sctp ports. The Docker User Guide explains in detail how to manipulate ports in Docker.
根据您的端口更新它,例如如果您的应用程序公开端口 8050
那么:
docker run -p 8050:8050 conjoint_dashboard
其中 -p = publish first one is the HOST port, and the second is the CONTAINER port.
您还可以更新您的 docker 文件:
FROM: continuumio/minicoda3
...
EXPOSE 8050/tcp
...
EXPOSE
指令实际上并不是 publish
端口。它作为构建映像的人和运行容器的人之间的一种文档,关于要发布哪些端口。
要在 运行 容器时实际发布端口,请在 docker 运行 上使用 -p
标志发布并映射一个或多个端口,或者 -P
标志发布所有暴露的端口并将它们映射到高阶端口。
默认情况下,EXPOSE 假定 TCP。您还可以指定 UDP: