美文网首页
dockerfile2

dockerfile2

作者: 运维_李汉兵 | 来源:发表于2020-04-07 13:12 被阅读0次
    #复制百度首页到Dockerfile下
    [root@web02 dockerfile]# cp /root/html/index.html .
    
    #编辑Dockerfile文件
    [root@web02 dockerfile]# vi Dockerfile
    
        FROM docker.io/lihanbing/nginx:v1.12.2
        ADD index.html /usr/share/nginx/html/index.html
        EXPOSE 80
    
    #构建Dockerfile文件
    [root@web02 dockerfile]# docker build . -t lihanbing/nginx:v1.12.2_with_index_expose
    
    #运行容器
    [root@web02 dockerfile]# docker run --rm -d --name nginx123 -P lihanbing/nginx:v1.12.2_with_index_expose
    
    [root@web02 dockerfile]# netstat -lnutp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1462/nginx: master  
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1111/sshd           
    tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1425/master         
    tcp6       0      0 :::32768                :::*                    LISTEN      22533/docker-proxy  
    tcp6       0      0 :::81                   :::*                    LISTEN      17090/docker-proxy  
    tcp6       0      0 :::82                   :::*                    LISTEN      17207/docker-proxy  
    tcp6       0      0 :::22                   :::*                    LISTEN      1111/sshd           
    tcp6       0      0 ::1:25                  :::*                    LISTEN      1425/master         
    udp        0      0 127.0.0.1:323           0.0.0.0:*                           705/chronyd         
    udp6       0      0 ::1:323                 :::*                                705/chronyd
    
    #访问 http://10.4.7.4:32768/     
    

    相关文章

      网友评论

          本文标题:dockerfile2

          本文链接:https://www.haomeiwen.com/subject/oyngphtx.html