dockerfile综合实验

#编辑Dockerfile
FROM lihanbing/nginx:v1.12.2
USER root
ENV WWW /usr/share/nginx/html
ENV CONF /etc/nginx/conf.d
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime &&\ 
    echo 'Asia/Shanghai' >/etc/timezone
WORKDIR $WWW
ADD index.html $WWW/index.html
ADD demo.od.com.conf $CONF/demo.od.com.conf
EXPOSE 80
CMD ["nginx","-g","daemon off;"]

#[root@web02 dockerfile]# vi demo.od.com.conf
server {
   listen 80;
   server_name demo.od.com;

   root /usr/share/nginx/html;
}

#构建镜像
[root@web02 dockerfile]# docker build . -t lihanbing/nginx:baidu

#运行容器
[root@web02 dockerfile]# docker run --rm -p80:80 lihanbing/nginx:baidu

你可能感兴趣的:(dockerfile综合实验)