上篇讲到使用Docker 部署nginx,并将Nginx的首页替换掉,我们将这个替换后的镜像打包成新的版本操作如下:
exit
[root@docker ~]# docker diff webserv
C /var
C /var/cache
C /var/cache/nginx
A /var/cache/nginx/client_temp
A /var/cache/nginx/fastcgi_temp
A /var/cache/nginx/proxy_temp
A /var/cache/nginx/scgi_temp
A /var/cache/nginx/uwsgi_temp
C /usr
C /usr/share
C /usr/share/nginx
C /usr/share/nginx/html
C /usr/share/nginx/html/index.html
C /run
A /run/nginx.pid
C /root
A /root/.bash_history
[root@docker ~]# docker commit --author "dapao" --message "update index.html" webserv nginx:v2
sha256:db581c8d5406c7271e88732ef3b249f5e2310d0b491b79a67df614cb9f4c59bb
[root@docker ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx v2 db581c8d5406 12 seconds ago 127MB
nginx latest 2073e0bcb60e 2 weeks ago 127MB
[root@docker ~]#
部署这个镜像 nginx:v2 映射到 81端口
docker run --name webserv2 -d -p 81:81 nginx:v2