Dockerfile
[root@localhost nginx]# cat Dockerfile
FROM centos:7
MAINTAINER 1135014515 <1135014515@qq.com>
#ENV 设置环境变量
ENV PATH /usr/local/nginx/sbin:$PATH
ADD http://nginx.org/download/nginx-1.18.0.tar.gz /usr/local/
RUN cd /usr/local/ \
&& tar xzvf nginx-1.18.0.tar.gz -C /usr/local/ \
&& /bin/rm -rf nginx-1.18.0.tar.gz
WORKDIR /usr/local/nginx-1.18.0
RUN yum -y install gcc pcre pcre-devel openssl openssl-devel zlib-devel gd gd-devel perl perl-ExtUtils-Embed net-tools \
&& ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module \
&& make && make install \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
EXPOSE 80
CMD ["/usr/local/nginx/sbin/nginx","-g","daemon off;"]
制作镜像
docker build -t nginx:18 .
<