title: AWS ElasticBeanstalk failed to deploy Django/Postgres app
body: <p>I'm having a hard time deploying my app built with Django, Postgres, DjangoQ, Redis and ES on AWS Elastic Beanstalk, using docker-compose.yml.</p>
  <p>I've used EB CLI (eb init, eb create) to do it and it shows the environment is successfully launched but I still have the following problem.</p>
  <ol>
  <li><p>On the EC2 instance, there is no postgres, djangoq and ec containers built like it says in the docker-compose file as below. Only django, redis and ngnix containers are found on the ec2 instance.</p>
  </li>
  <li><p>The environment variables that I specified in the docker-compose.yml file aren't being configured to the django container on EC2, so I can't run django there.</p>
  </li>
  </ol>
  <p>I'm pretty lost and am not sure where to even start to fix the problems here.. Any insight will be very much appreciated..</p>
  <pre><code>version: '3'
  services:
    django:
      build:
        context: .
        dockerfile: docker/Dockerfile
      command: gunicorn --bind 0.0.0.0:5000 etherscan_project.wsgi:application
      env_file: .env
      volumes:
        - $PWD:/srv/app/:delegated
      depends_on:
        - redis
        - db
        - es
  
    django-q:
      build:
        context: .
        dockerfile: docker/Dockerfile
      command: &gt;
        sh -c &quot;python manage.py makemigrations &amp;&amp; 
               python manage.py migrate &amp;&amp;
               python manage.py qcluster&quot;
      env_file: .env
      volumes:
        - $PWD:/srv/app/:delegated
      depends_on:
        - redis
        - db
        - django
        - es
  
    db:
      image: postgres:latest
      expose:
        - 5432
      env_file: .env
      volumes:
        - ./docker/volumes/postgres:/var/lib/postgresql/data
      healthcheck:
        test: [&quot;CMD-SHELL&quot;, &quot;pg_isready -U $POSTGRES_DB&quot;]
        interval: 10s
        timeout: 5s
        retries: 5
  
    redis:
      image: redis:latest
      expose: 
        - 6379
      ports: 
        - 6379:6379
      volumes: 
        - ./docker/volumes/redis:/data
      
    nginx:
      container_name: nginx
      image: nginx:1.13
      ports:
        - 80:80
      depends_on:
        - db
        - django
        - redis
      volumes:
        - ./docker/nginx:/etc/nginx/conf.d
        - $PWD:/srv/app/:delegated
      
    es:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.13.4
      ports: 
        - 9200:9200
        - 9300:9300
      expose:
        - 9200
        - 9300
      environment: 
        - discovery.type=single-node 
        - xpack.security.enabled=false
      ulimits: 
        memlock:
          soft: -1
          hard: -1
      volumes:
        - ./docker/volumes/es:/usr/share/elasticsearch/data 
  
  volumes:
    app-files:
      driver_opts:
        type: nfs
        device: $PWD
        o: bind
  
  </code></pre>