title: docker-compose up is failing becuase of COPY conf.d/* /etc/nginx/conf.d is not working
body: <p>I have <code>Dockerfile</code> that does:</p>
  
  <pre><code>COPY conf.d/* /etc/nginx/conf.d/
  </code></pre>
  
  <p>and in my <code>nginx.conf</code> i am including this from the same directory in my docker image: </p>
  
  <pre><code>include /etc/nginx/conf.d/default.conf;
  </code></pre>
  
  <p>But, when I want to <code>docker-compose up</code> it is failing, because of this line in nginx.conf: </p>
  
  <pre><code>include /etc/nginx/conf.d/default.conf;
  </code></pre>
  
  <p>And the error is: </p>
  
  <blockquote>
    <p>2019/07/17 14:07:35 [emerg] 1#1: open() "/etc/nginx/conf.d/default.conf" failed (2: No such file or directory) in /etc/nginx/nginx.conf:14</p>
  </blockquote>
  
  <p>I made sure that I have conf.d folder and inside this folder I have following files:<br/>
   1. default.conf<br/>
   2. ssl.conf <br/>
   3. header.conf</p>
  
  <p><br/>
  My whole <code>Dockerfile</code>:</p>
  
  <pre><code># https://github.com/nginxinc/docker-nginx/tree/master/stable/alpine
  # https://github.com/arut/nginx-rtmp-module
  
  FROM alpine:3.8
  
  ENV NGINX_VERSION 1.14.1
  ENV NGINX_RTMP_MODULE_VERSION 1.2.1
  
  RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
      &amp;&amp; CONFIG="\
          --prefix=/etc/nginx \
          --sbin-path=/usr/sbin/nginx \
          --modules-path=/usr/lib/nginx/modules \
          --conf-path=/etc/nginx/nginx.conf \
          --error-log-path=/var/log/nginx/error.log \
          --http-log-path=/var/log/nginx/access.log \
          --pid-path=/var/run/nginx.pid \
          --lock-path=/var/run/nginx.lock \
          --http-client-body-temp-path=/var/cache/nginx/client_temp \
          --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
          --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
          --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
          --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
          --user=nginx \
          --group=nginx \
          --with-http_ssl_module \
          --with-http_realip_module \
          --with-http_addition_module \
          --with-http_sub_module \
          --with-http_dav_module \
          --with-http_flv_module \
          --with-http_mp4_module \
          --with-http_gunzip_module \
          --with-http_gzip_static_module \
          --with-http_random_index_module \
          --with-http_secure_link_module \
          --with-http_stub_status_module \
          --with-http_auth_request_module \
          --with-http_xslt_module=dynamic \
          --with-http_image_filter_module=dynamic \
          --with-http_geoip_module=dynamic \
          --with-threads \
          --with-stream \
          --with-stream_ssl_module \
          --with-stream_ssl_preread_module \
          --with-stream_realip_module \
          --with-stream_geoip_module=dynamic \
          --with-http_slice_module \
          --with-mail \
          --with-mail_ssl_module \
          --with-compat \
          --with-file-aio \
          --with-http_v2_module \
      " \
      &amp;&amp; addgroup -S nginx \
      &amp;&amp; adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
      &amp;&amp; apk add --no-cache --virtual .build-deps \
          gcc \
          libc-dev \
          make \
          openssl-dev \
          pcre-dev \
          zlib-dev \
          linux-headers \
          curl \
          gnupg1 \
          libxslt-dev \
          gd-dev \
          geoip-dev \
      &amp;&amp; curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz -o nginx.tar.gz \
      &amp;&amp; curl -fSL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz.asc  -o nginx.tar.gz.asc \
      &amp;&amp; export GNUPGHOME="$(mktemp -d)" \
      &amp;&amp; found=''; \
      for server in \
          ha.pool.sks-keyservers.net \
          hkp://keyserver.ubuntu.com:80 \
          hkp://p80.pool.sks-keyservers.net:80 \
          pgp.mit.edu \
      ; do \
          echo "Fetching GPG key $GPG_KEYS from $server"; \
          gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$GPG_KEYS" &amp;&amp; found=yes &amp;&amp; break; \
      done; \
      test -z "$found" &amp;&amp; echo &gt;&amp;2 "error: failed to fetch GPG key $GPG_KEYS" &amp;&amp; exit 1; \
      gpg --batch --verify nginx.tar.gz.asc nginx.tar.gz \
      &amp;&amp; rm -rf "$GNUPGHOME" nginx.tar.gz.asc \
      &amp;&amp; mkdir -p /usr/src \
      &amp;&amp; tar -zxC /usr/src -f nginx.tar.gz \
      &amp;&amp; rm nginx.tar.gz \
    \
    # Nginx RTMP Module
      &amp;&amp; CONFIG="$CONFIG --add-module=/usr/src/nginx-rtmp-module-$NGINX_RTMP_MODULE_VERSION " \
    &amp;&amp; curl -fSL https://github.com/arut/nginx-rtmp-module/archive/v$NGINX_RTMP_MODULE_VERSION.tar.gz -o nginx-rtmp-module.tar.gz \
    &amp;&amp; tar -zxC /usr/src -f nginx-rtmp-module.tar.gz \
      &amp;&amp; rm nginx-rtmp-module.tar.gz \
    \
      &amp;&amp; cd /usr/src/nginx-$NGINX_VERSION \
      &amp;&amp; ./configure $CONFIG --with-debug \
      &amp;&amp; make -j$(getconf _NPROCESSORS_ONLN) \
      &amp;&amp; mv objs/nginx objs/nginx-debug \
      &amp;&amp; mv objs/ngx_http_xslt_filter_module.so objs/ngx_http_xslt_filter_module-debug.so \
      &amp;&amp; mv objs/ngx_http_image_filter_module.so objs/ngx_http_image_filter_module-debug.so \
      &amp;&amp; mv objs/ngx_http_geoip_module.so objs/ngx_http_geoip_module-debug.so \
      &amp;&amp; mv objs/ngx_stream_geoip_module.so objs/ngx_stream_geoip_module-debug.so \
      &amp;&amp; ./configure $CONFIG \
      &amp;&amp; make -j$(getconf _NPROCESSORS_ONLN) \
      &amp;&amp; make install \
      &amp;&amp; rm -rf /etc/nginx/html/ \
      &amp;&amp; mkdir /etc/nginx/conf.d/ \
      &amp;&amp; mkdir -p /usr/share/nginx/html/ \
      &amp;&amp; install -m644 html/index.html /usr/share/nginx/html/ \
      &amp;&amp; install -m644 html/50x.html /usr/share/nginx/html/ \
      &amp;&amp; install -m755 objs/nginx-debug /usr/sbin/nginx-debug \
      &amp;&amp; install -m755 objs/ngx_http_xslt_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_xslt_filter_module-debug.so \
      &amp;&amp; install -m755 objs/ngx_http_image_filter_module-debug.so /usr/lib/nginx/modules/ngx_http_image_filter_module-debug.so \
      &amp;&amp; install -m755 objs/ngx_http_geoip_module-debug.so /usr/lib/nginx/modules/ngx_http_geoip_module-debug.so \
      &amp;&amp; install -m755 objs/ngx_stream_geoip_module-debug.so /usr/lib/nginx/modules/ngx_stream_geoip_module-debug.so \
      &amp;&amp; ln -s ../../usr/lib/nginx/modules /etc/nginx/modules \
      &amp;&amp; strip /usr/sbin/nginx* \
      &amp;&amp; strip /usr/lib/nginx/modules/*.so \
      &amp;&amp; rm -rf /usr/src/nginx-$NGINX_VERSION \
    \
    # Remove temp directory for rtmp module
    &amp;&amp; rm -rf /usr/src/nginx-rtmp-module-$NGINX_RTMP_MODULE_VERSION \
      \
      # Bring in gettext so we can get `envsubst`, then throw
      # the rest away. To do this, we need to install `gettext`
      # then move `envsubst` out of the way so `gettext` can
      # be deleted completely, then move `envsubst` back.
      &amp;&amp; apk add --no-cache --virtual .gettext gettext \
      &amp;&amp; mv /usr/bin/envsubst /tmp/ \
      \
      &amp;&amp; runDeps="$( \
          scanelf --needed --nobanner --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /tmp/envsubst \
              | tr ',' '\n' \
              | sort -u \
              | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
      )" \
      &amp;&amp; apk add --no-cache --virtual .nginx-rundeps $runDeps \
      &amp;&amp; apk del .build-deps \
      &amp;&amp; apk del .gettext \
      &amp;&amp; mv /tmp/envsubst /usr/local/bin/ \
      \
      # Bring in tzdata so users could set the timezones through the environment
      # variables
      &amp;&amp; apk add --no-cache tzdata \
      \
      # forward request and error logs to docker log collector
      &amp;&amp; ln -sf /dev/stdout /var/log/nginx/access.log \
      &amp;&amp; ln -sf /dev/stderr /var/log/nginx/error.log
  
  RUN mkdir -p /etc/letsencrypt/live/yuz1.org
  COPY cert/* /etc/letsencrypt/live/yuz1.org/
  
  RUN mkdir -p /etc/nginx/conf.d
  COPY nginx.conf /etc/nginx/nginx.conf
  COPY mime.types /etc/nginx/mime.types
  COPY conf.d/* /etc/nginx/conf.d/
  
  EXPOSE 80
  EXPOSE 443
  EXPOSE 1047
  EXPOSE 1935
  
  STOPSIGNAL SIGTERM
  
  CMD ["nginx", "-g", "daemon off;"]
  </code></pre>
  
  <p>And my whole <code>nginx.conf</code>: </p>
  
  <pre><code>user  nginx;
  worker_processes  1;
  
  error_log  /var/log/nginx/error.log warn;
  pid        /var/run/nginx.pid;
  
  
  events {
      worker_connections  1024;
  }
  
  http {
      include     /etc/nginx/mime.types;
      include     /etc/nginx/conf.d/default.conf;
      default_type  application/octet-stream;
  
      log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';
  
      access_log  /var/log/nginx/access.log  main;
  
      sendfile        on;
      #tcp_nopush     on;
  
      keepalive_timeout  65;
  
      #gzip  on;
  
  }
  </code></pre>
  
  <p>My whole <code>docker-compose.yml</code>: </p>
  
  <pre><code>version: "3.5"
  
  services:
    app:
      image: gcr.io/bounce-code/nodes/proxy-server
      build:
        context: .
        dockerfile: Dockerfile
      restart: always
      command: "/bin/sh -c 'while :; do sleep 6h &amp; wait $${!}; nginx -s reload; done &amp; nginx -g \"daemon off;\"'"
      networks:
        publicnet:
          aliases:
            - internal.yuz1.org
            - dev.yuz1.org
            - yuz1.org
        servicenet:
          aliases:
            - proxy.node.internal.yuz1.org
      volumes:
        - ./data/nginx:/etc/nginx/conf.d
        - ./data/certbot/conf:/etc/letsencrypt
        - ./data/certbot/www:/var/www/certbot
      ports:
        - 80:80
        - 443:443
        - 1047:1047
        - 1935:1935
    certbot:
      image: certbot/certbot
      entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h &amp; wait $${!}; done;'"
      volumes:
        - ./data/certbot/conf:/etc/letsencrypt
        - ./data/certbot/www:/var/www/certbot
  
  networks:
    servicenet:
      name: yuz1-servicenet
    publicnet:
      name: yuz1-publicnet
  
  </code></pre>
  
  <p>My folder structure: 
  <a href="https://i.stack.imgur.com/HCuVz.png" rel="nofollow noreferrer">folder structure</a></p>