title: Storing docker nginx access logs inside a docker volume
body: <p>Currently my docker container is printing the nginx access logs to /dev/stdout.  How do I create a volume inside my docker container to store the access logs?</p>
  
  <p>My Dockerfile:</p>
  
  <pre><code>FROM python:3.7
  
  ENV APP_ROOT /src
  ENV CONFIG_ROOT /config
  
  RUN apt-get update
  RUN apt-get install -y apt-utils
  RUN apt-get -y install unixodbc-dev
  RUN apt-get -y install default-libmysqlclient-dev
  
  RUN mkdir ${CONFIG_ROOT}
  COPY /app/requirements.txt ${CONFIG_ROOT}/requirements.txt
  RUN pip install -r ${CONFIG_ROOT}/requirements.txt
  
  RUN mkdir ${APP_ROOT}
  WORKDIR ${APP_ROOT}
  
  ADD /app/ ${APP_ROOT}
  </code></pre>
  
  <p>My docker-compose.yml:</p>
  
  <pre><code>version: "3"
  
  services:
    app:
      build: .
      container_name: django-gunicorn
      restart: always
      env_file:
        - django.env
      ports:
        - "8000:8000"
      command:
        "gunicorn --workers=2 --bind=0.0.0.0:8000 mysite.wsgi:application"
  
    nginx:
      image: nginx:1.14
      container_name: ngx
      ports:
        - "80:80"
        - "443:443"
      volumes:
        - ./nginx:/etc/nginx/conf.d
        - ./app/static:/static
      depends_on:
        - app
  </code></pre>
  
  <p>My nginx/default.conf:</p>
  
  <pre><code>limit_req_zone "$binary_remote_addr$request_uri" zone=one:10m rate=60r/m;
  
  server {
      listen 80;
      server_name example.org;
      server_tokens off;
  
      location  /static/ {
          autoindex on;
          alias /static/;
      }
  
      location / {
          proxy_pass http://app:8000;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          limit_req zone=one nodelay burst=30;
  
      }
  }
  </code></pre>
  
  <p>I am trying to add fail2ban and fluentd logging to this application but first I need to store the physical file (not /dev/stout) which can be used for other logging purposes.</p>
  
  <p>Thanks you! </p>