【问题标题】:docker nginx container not startingdocker nginx容器未启动
【发布时间】:2017-10-14 06:44:36
【问题描述】:

这是我的Dockerfile

FROM nginx

EXPOSE 8080

CMD ["nginx", "-g", "daemon off;"]

我使用docker build . 然后docker run -it 603030818c86 来启动我的nginx 容器。但是当我转到http://localhost:8080 时,它并没有给我nginx 主页。我做错了什么?

【问题讨论】:

    标签: docker nginx dockerfile


    【解决方案1】:

    你在 docker 网络中暴露了端口,尝试使用:

    docker run -it -p 8080:8080 603030818c86
    

    【讨论】:

    • http://localhost:8080时给我The connection to the server was reset while the page was loading.
    • 您在前台模式下运行容器,尝试简单的docker run -d -p 8080:80 nginx nginx -g 'daemon off;' 如果它有效,那么只需将nginx nginx -g 'daemon off;' 替换为您的图像名称。
    猜你喜欢
    • 2020-01-28
    • 2015-07-09
    • 2019-05-18
    • 2020-08-03
    • 1970-01-01
    • 2020-04-04
    • 2018-10-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多