无法从Windows到Docker镜像到达80端口

时间:2018-01-28 19:05:20

标签: docker

在安装了Docker的Windows 10上运行

// DockerFile
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y apache2
ADD index.html /var/www/html/
CMD /usr/sbin/apache2ctl -D FOREGROUND
EXPOSE 80

//构建图像,运行容器并检查IP

$ docker network inspect bridge

并获得enter image description here

"IPv4Address": "172.17.0.2/16"

尝试通过Chrome浏览器访问http://172.17.0.2时,我收到“无法访问此网站”

1 个答案:

答案 0 :(得分:0)

  1. 公开端口请检查您是否公开了端口号 80 。 (不仅在docker文件中)?但在您的泊坞窗运行命令中,您需要指定" -p 80:80 "。你能否分享你的命令,你如何运行你的码头集装箱?

  2. IPAddress: 172.17.0.2此IPAddress是docker内部docker ip地址,您需要使用 localhost your_machine_ip_address 来访问那个码头工人容器。

  3. 请告诉我,如果您遇到任何困难,请分享您的docker run命令。

相关问题