title: AWS ECS using docker and ngnix, how to get my nginx config into the container?
body: <p>I'm trying to setup a ECS cluster in AWS using Nginx, unicorn and Django.</p>
  
  <p>I have converted my docker-compose.yml into a ECS task, but am wondering how I get my nginx config into the container?</p>
  
  <p>this is my task in json</p>
  
  <p>I have created some mount points for files but am unsure how to get the config there.
  when I run docker from my local servers the nginx config file is local to the compose file, obviously in aws it is not?</p>
  
  <p>how do I get the nginx config into the contain through ecs?</p>
  
  <pre><code>{
      "containerDefinitions": [
          {
              "volumesFrom": null,
              "memory": 300,
              "extraHosts": null,
              "dnsServers": null,
              "disableNetworking": null,
              "dnsSearchDomains": null,
              "portMappings": [
                  {
                      "containerPort": 8000,
                      "protocol": "tcp"
                  }
              ],
              "hostname": null,
              "essential": true,
              "entryPoint": null,
              "mountPoints": [
                  {
                      "containerPath": "/static",
                      "sourceVolume": "_Static",
                      "readOnly": null
                  }
              ],
              "name": "it-app",
              "ulimits": null,
              "dockerSecurityOptions": null,
              "environment": null,
              "links": null,
              "workingDirectory": "/itapp",
              "readonlyRootFilesystem": null,
              "image": "*****.amazonaws.com/itapp",
              "command": [
                  "bash",
                  "-c",
                  "",
                  "python manage.py collectstatic --noinput &amp;&amp; python manage.py makemigrations &amp;&amp; python manage.py migrate &amp;&amp; gunicorn itapp.wsgi -b 0.0.0.0:8000"
              ],
              "user": null,
              "dockerLabels": null,
              "logConfiguration": null,
              "cpu": 0,
              "privileged": null
          },
          {
              "volumesFrom": null,
              "memory": 300,
              "extraHosts": null,
              "dnsServers": null,
              "disableNetworking": null,
              "dnsSearchDomains": null,
              "portMappings": [
                  {
                      "hostPort": 80,
                      "containerPort": 8000,
                      "protocol": "tcp"
                  }
              ],
              "hostname": null,
              "essential": true,
              "entryPoint": null,
              "mountPoints": [
                  {
                      "containerPath": "/etc/nginx/conf.d",
                      "sourceVolume": "_ConfigNginx",
                      "readOnly": null
                  },
                  {
                      "containerPath": "/static",
                      "sourceVolume": "_Static",
                      "readOnly": null
                  }
              ],
              "name": "nginx",
              "ulimits": null,
              "dockerSecurityOptions": null,
              "environment": null,
              "links": [
                  "it-app"
              ],
              "workingDirectory": null,
              "readonlyRootFilesystem": null,
              "image": "nginx:latest",
              "command": null,
              "user": null,
              "dockerLabels": null,
              "logConfiguration": null,
              "cpu": 0,
              "privileged": null
          }
      ],
      "placementConstraints": [],
      "volumes": [
          {
              "host": {
                  "sourcePath": "./config/nginx"
              },
              "name": "_ConfigNginx"
          },
          {
              "host": {
                  "sourcePath": "./static"
              },
              "name": "_Static"
          }
      ],
      "family": "it-app-task",
      "networkMode": "bridge"
  }
  </code></pre>
  
  <p>ngnix config</p>
  
  <pre><code>upstream web {  
    ip_hash;
    server web:8000;
  }
  server {
      location /static/ {    
          autoindex on;    
          alias /static/; 
      }
      location / {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_pass http://web/;
      }
      listen 8000;
      server_name localhost;
  }
  </code></pre>