This is my Dockerfile:
FROM centos
MAINTAINER salamander ********@qq.com
RUN yum install -y pcre-devel wget net-tools gcc zlib zlib-devel make openssl-devel
# Add File
ADD http://nginx.org/download/nginx-1.12.1.tar.gz
RUN tar -zxvf nginx-1.12.1.tar.gz .
RUN mkdir -p /usr/local/nginx
RUN cd nginx-1.12.1 && ./configure --prefix=/usr/local/nginx && make && make install
RUN rm -vf /usr/local/nginx/conf/nginx.conf
COPY ./nginx_conf /usr/local/nginx/conf/nginx.conf
# Expose ports
EXPOSE 80
CMD service nginx start
I want to set the actual configuration file reading location of Nginx to/home/www/doc/etc/NGINX
The path of this Dockerfile is under /home/www/docker.
I want to ask,
COPY .nginx_conf /usr/local/nginx/conf/nginx.conf
You should have written it wrong. It should be writtenCOPY nginx_conf /usr/local/nginx/conf/nginx.conf
Let’s see. It is nginx.conf that covers docker.If you want to set the configuration file directory, you can add it at startup.
-v
Parameters:docker run -d -v $PWD/etc/nginx:/usr/local/nginx/conf/ YOUR_IMAGE_NAME
However, I suggest nginx to directly use the official image.
FROM nginx:1.12 COPY etc/nginx /etc/nginx/conf.d/ EXPOSE 80 ENTRYPOINT ["nginx", "-g", "daemon off;" ]
Just wrote an article about docker, you canLook.