标签:pre uil 目录 dock sbin 执行 http nload env
在nginx目录下载所需的包wget http://nginx.org/download/nginx-1.14.0.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre2-10.23.tar.gz --no-check-certificate
下面是DockerFile的命令意思
FROM 继承自谁
MAINTAINER 维护者
RUN干什么
ADD 放点文件进去
workdir 当前的工作目录
volume 目录挂载
EXPOSE 打开的端口
RUN
创建Dockerfile
vi Dockerfile
内容是:
#This is my first Dockerfile
#Version 1.0
#Author:shejiewei
FROM centos
MAINTAINER shejiwei
ADD nginx-1.14.0.tar.gz /usr/local/src
ADD pcre2-10.23.tar.gz /usr/local/src
RUN yum install -y wget gcc gcc-c++ make openssl-devel
RUN useradd -s /sbin/nologin -M www
WORKDIR /usr/local/src/nginx-1.14.0
RUN ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre2-10.23 && make && make install
RUN echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf
ENV PATH /usr/local/nginx/sbin:$PATH
EXPOSE 80
CMD ["nginx"]
然后执行:
docker build -t nginx-file:v1 /data/docker/docker-file/nginx 开始构建
标签:pre uil 目录 dock sbin 执行 http nload env
原文地址:https://www.cnblogs.com/shejiewei/p/9865587.html