这篇文章主要介绍了CentOS7 Docker Nginx部署及运行详解,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
网上找了一些资料部署,出现不一样的问题,现在总结一下自己的部署流程。
1、资源准备
Dockerfile文件
“ported” by Adam Miller maxamillion@fedoraproject.org from # https://github.com/fedora-cloud/Fedora-Dockerfiles # # Originally written for Fedora-Dockerfiles by # scollier scollier@redhat.com FROM centos:centos7 MAINTAINER The CentOS Project cloud-ops@centos.org RUN yum -y update; yum clean all RUN yum -y install epel-release tar ; yum clean all RUN yum -y install nginx ; yum clean all ADD nginx.conf /opt/deploy/nginx/nginx.conf RUN echo “daemon off;” >> /opt/deploy/nginx/nginx.conf #RUN curl https://git.centos.org/sources/httpd/c7/acf5cccf4afaecf3afeb18c50ae59fd5c6504910 \ # | tar -xz -C /usr/local/nginx/html \ # --strip-components=1 #RUN sed -i -e ‘s/Apache/nginx/g’ -e ‘/apache_pb.gif/d’ \ # /usr/local/nginx/html/index.html EXPOSE 80 #CMD [ “/usr/local/nginx/sbin” ]
注意:路径需要在系统上面存在以及对应
nginx.conf文件