Mac OS在这里,运行Docker版本17.12.0-ce-mac49.我有以下超级简单的Dockerfile:
FROM Nginx
copY index.html /usr/share/Nginx/html
我创建了我的Docker镜像:
docker build -t mydocBox .
docker run -it -p 8080:8080 -d --name mydocBox mydocBox
而且我看到它正在运行(我已通过发布docker ps以及通过docker exec -it< containerId> bash并确认/usr/share/Nginx/html/index.html存在而通过SSH进入框中确认了它的运行情况)!
当我打开浏览器并转到http:// localhost:8080时,我得到一个空的/空白/没有看到这里的屏幕,而不是我期望的index.html页面.
我没有在任何地方看到任何错误,没有任何迹象表明配置错误或防火墙导致问题.关于问题可能是什么或我如何排除故障的任何想法?
解决方法:
看看你是否可以关注this example:
FROM Nginx:alpine
copY default.conf /etc/Nginx/conf.d/default.conf
copY index.html /usr/share/Nginx/html/index.html
它使用default.conf file指定使用的index.html
location / {
root /usr/share/Nginx/html;
index index.html index.htm;
}
将default.conf中的侦听端口从80更改为8080,并将其EXPROP.
或者简单地使用-p 8080:80(hostPort:containerPort)运行docker.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。