zoukankan      html  css  js  c++  java
  • docker创建nginx镜像

    docker创建nginx镜像

    1.docker仓库中搜索nginx镜像。

    [root@localhost ~]# docker search nginx
    

    2.下载nginx镜像,这里我们选择下载人数最多的镜像版本。

    [root@localhost ~]# docker pull docker.io/nginx
    

    3.查看nginx是否下到本地

    [root@localhost ~]# docker images |grep -i nginx #-i 忽略字符大小写
    

    4.基于本地nginx镜像启动nginx web服务

    [root@localhost ~]# docker run -itd -p80:80 docker.io/nginx
       # run 全新启动一台容器
       # -i interactive交互模式
       # -t tty打开一个终端
       # -d daemon后台启动
       # -p 开启DNAT映射,讲宿主机80端口映射至容器的80,用户访问宿主机的80,即是访问
          容器的80
    

    5.查看已启动nginx容器

    [root@localhost ~]# docker ps
    

    6.查看nginx容器的ip地址

    [root@localhost ~]# docker inspect e9aedca5f8f4 |grep -i ipaddr|tail -1|awk -F" '{print $4}'
    172.17.0.2
    

    7.访问nginx容易中web服务

      [root@localhost ~]# curl 172.17.0.2
      <!DOCTYPE html>
      <html>
      <head>
      <title>Welcome to nginx!</title>
      <style>
          body {
               35em;
              margin: 0 auto;
              font-family: Tahoma, Verdana, Arial, sans-serif;
          }
      </style>
      </head>
      <body>
      <h1>Welcome to nginx!</h1>
      <p>If you see this page, the nginx web server is successfully installed and
      working. Further configuration is required.</p>
      <p>For online documentation and support please refer to
      <a href="http://nginx.org/">nginx.org</a>.<br/>
      Commercial support is available at
      <a href="http://nginx.com/">nginx.com</a>.</p>
      
      <p><em>Thank you for using nginx.</em></p>
      </body>
      </html>
    
  • 相关阅读:
    C#处理json实战
    HDU3994(Folyd + 期望概率)
    POJ1270 Following Orders (拓扑排序)
    HDU 3634 City Planning (离散化)
    HDU4762(JAVA大数)
    POJ3026(BFS + prim)
    POJ1679(次小生成树)
    UVA10487(二分)
    ZOJ 2048(Prim 或者 Kruskal)
    FZU 1856 The Troop (JAVA高精度)
  • 原文地址:https://www.cnblogs.com/linux123/p/11745453.html
Copyright © 2011-2022 走看看