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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容