美文网首页DockerAwesome Docker
Dockerize static html with nginx

Dockerize static html with nginx

作者: 竹林品雨 | 来源:发表于2015-10-14 11:48 被阅读74次

    0. Folder structure

    Folder name nginx_static

    nginx_static   
      |
       -- Dockerfile
      |
       -- index.html
    

    I. Dockerfile

    FROM nginx:latest
    COPY . /usr/share/nginx/html
    

    II. index.html

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title>NginxDockerize static html</title>
      </head>
      <body>
        <h3>You known, Docker   Nginx.</h3>
      </body>
    </html>
    

    III. Build (work in folder nginx_static)

    docker build -t nginx_static .
    

    IV. Run

    docker run -d --name nginx_static -p 80:80 nginx_static
    

    V. Result

    osx visit: http://192.168.99.100


    nginx_dockerize_static_html.pngnginx_dockerize_static_html.png

    Update index.html

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title>NginxDockerize static html</title>
      </head>
      <body>
        <h3>You known, Docker   Nginx.</h3>
        <h3>Need update</h3>
        https://ruby-china.org/topics/25477
    
        http://www.gulpjs.com.cn/
    
        http://leveluptuts.com/tutorials/learning-gulp
    
        http://markpop.github.io/2014/09/17/Gulp%E5%85%A5%E9%97%A8%E6%95%99%E7%A8%8B/
      </body>
    </html>
    

    stop & delete runing nginx_static

    docker stop nginx_static
    docker rm nginx_static
    

    re-build nginx_static

    docker build -t nginx_static .
    

    re-run

    docker run -d --name nginx_static -p 80:80 nginx_static
    

    Result

    osx visit: http://192.168.99.100


    nginx_dockerize_static_html_update.pngnginx_dockerize_static_html_update.png

    相关文章

      网友评论

        本文标题:Dockerize static html with nginx

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