title: How do you setup an AWS Elastic Beanstalk Docker Platform running Django?
body: <p>I have been running a regular Django site using the regular EB Python platform, but for some reasons, I want to migrate to using a Docker image, but still get everything I get from Elastic Beanstalk.
  In order to demonstrate the problem, I created a small Django project at <a href="https://github.com/dkarchmer/aws-eb-docker-django" rel="nofollow">https://github.com/dkarchmer/aws-eb-docker-django</a> which works on both Python 2.7 and 3.4, and it is a simplified version of my real site.
  Anyway, I will be happy getting this to work with either the Preconfigured Docker Platform, or with a generic Docker platform.
  My Google searches have only found the super simple, Flask based example that AWS shows, and a couple of questions on Stackoverflow, but it almost seems like nobody is trying to put a Django project on EB/Docker.
  Anyway, lets start with a generic solution, which is my preferred option.
  If you download the Github project, you can successfully use docker (or better, docker-sompose) to test that the image works when run locally (I am running on a MacOS). 
  It is not clear if I should use a CMD to define specify my "python manage.py runserver" or if I need an ENTRYPOINT, or if I need to use uswgi (as the preconfigured solution does).
  I believe I need a CMD, so that is what I am doing:</p>
  
  <pre><code>  FROM python:3.4
  
    RUN adduser --disabled-password --gecos '' myuser
  
    # Install PostgreSQL dependencies
    # Install Postgres
    RUN apt-get update &amp;&amp; apt-get install -y \
          postgresql-9.3 \
          libpq-dev \
          libjpeg-dev; \
          apt-get clean
  
   # Step 1: Install any Python packages
   # ----------------------------------------
  
   RUN mkdir /var/app
   WORKDIR  /var/app
   COPY requirements.txt /var/app/
   RUN pip install -r requirements.txt
  
   # Step 2: Copy Django Code
   # ----------------------------------------
  
   COPY authentication /var/app/authentication
   COPY myproject /var/app/myproject
   COPY settings /var/app/settings
   COPY manage.py /var/app/
  
   ENV DJANGO_SETTINGS_MODULE=settings.production
  
   EXPOSE 8080
  
   WORKDIR  /var/app
   CMD ["python", "/var/app/manage.py", "runserver", "0.0.0.0:8080"]
  </code></pre>
  
  <p>You can look (download and try) the code at the Github link above.</p>
  
  <p>When I deploy (see <code>fab eb_create_custom</code> in fabfile.py), I get</p>
  
  <pre><code>[2015-05-02T15:22:27.245Z] INFO  [1732]  - [CMD-Startup/StartupStage0/AppDeployPreHook/04run.sh] : Activity execution failed, because: 17212f02bce509d43c40eeac9f53a281eecf1502387dac69c096c337c9c7b186
   Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Sat May  2 15:22:27 UTC 2015:
   python3: can't open file 'manage.py': [Errno 2] No such file or directory. Check snapshot logs for details. (ElasticBeanstalk::ExternalInvocationError) caused by: 17212f02bce509d43c40eeac9f53a281eecf1502387dac69c096c337c9c7b186
  </code></pre>
  
  <p>I have confirmed the manage.py file is there. I have downloaded the full logs and cannot see much, other than the error above.</p>
  
  <p>Any insides? Anybody knows of an example for running Django on EB Docker?</p>
  
  <p>Thanks</p>