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
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
网友评论