1.下载 nginx 的配置文件 wget
http://www.apelearn.com/study_v2/.nginx_conf
2.vi Dockerfile
FROM centos
MAINTAINER aming aming@apelearn.com
RUN yum install -y pcre-devel wget net-tools gcc zlib zlib-devel make openssl-devel
RUN tar zxvf
nginx-1.8.0.tar.gz
RUN mkdir -p /usr/local/nginx
RUN cd
nginx-1.8.0 && ./configure --prefix=
/usr/local/nginx && make && make install
RUN rm -fv
/usr/local/nginx/conf/nginx.conf
COPY .nginx_conf
/usr/local/nginx/conf/nginx.conf
EXPOSE 80
# CMD
/usr/local/nginx/sbin/nginx -c
/usr/local/nginx/conf/nginx.conf
2.创建镜像
docker build -t centos_nginx . 其中 . 代表dockerfile 所在的文件的路径