I am writing to a create a docker file to run openresty nginx in a container.
my docker file is below.
FROM ubuntu:latest
ENV PATH="/usr/local/openresty/nginx/sbin:${PATH}"
LABEL info="running open resty on docker container"
RUN apt-get update -y \
&& apt-get install -y wget \
&& wget -qO - https://openresty.org/package/pubkey.gpg | apt-key add - \
&& apt-get -y install software-properties-common \
&& add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" \
&& apt-get update -y \
&& apt-get install -y openresty
RUN mkdir -p /opt/poc
RUN cd /opt/poc \
&& mkdir logs \
&& touch logs/error.log \
&& mkdir conf \
&& cd ../
RUN chmod -R 755 /opt/poc
WORKDIR /opt/poc
ADD ./conf/nginx.conf conf/
EXPOSE 8383
CMD ["nginx", "-p /opt/poc","-c conf/nginx.conf"]
The image gets built with no issues. But when I run the docker I am getting the below error message.
nginx: [alert] could not open error log file: open() " /opt/poc/logs/error.log" failed (2: No such file or directory) 2017/09/23 03:35:44 [emerg] 1#1: open() " /opt/poc/ conf/nginx.conf" failed (2: No such file or directory)
instead of running CMD ["nginx", "-p /opt/poc","-c conf/nginx.conf"]
if I change to CMD $ls
the docker is listing the conf and logs directory. so I am not sure what I am missing here.