Dockerize static html with nginx

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.png
nginx_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.png
nginx_dockerize_static_html_update.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容