How to deploy django 1.8 on Elastic Beanstalk using Docker

550 Views Asked by At

My restrictions are:

  1. Django is to be deployed using uWSGI with nginx
  2. Django app is to use postgresql that is hosted on RDS
  3. the dockerfile will use ubuntu:14.04 as the container OS

This is what I have for docker setup:

https://github.com/simkimsia/aws-docker-django

It contains a dockerfile and other configuration files. I have tested it on linux box. It works.

This is what I have tried. I logged into AWS console and selected Elastic Beanstalk and then selected create new application using docker as environment.

A new environment is created and it prompts me to upload and deploy.

I zipped up all the files you see in https://github.com/simkimsia/aws-docker-django and uploaded the zip file.

enter image description here

I got error with deploying.

I have also subsequently tried with using the following json file.

 {
   "AWSEBDockerrunVersion": "1",
   "Volumes": [
     {
       "ContainerDirectory": "/var/app",
       "HostDirectory": "/var/app"
     }
   ],
   "Logging": "/var/eb_log"
 }

I have answers such as this but they will go against at least one of the 3 restrictions I have.

How do I go about achieving deployment on AWS beanstalk using Docker?

1

There are 1 best solutions below

0
On

Have you been able to run any docker images on Elastic Beanstalk? I was having several issues, but eventually documented my solution here: https://github.com/dkarchmer/aws-eb-docker-django

It does not use nginx but that should all be on your Dockerfile, so you should be able to reverse engineer my example and ideally just use your own Dockerfile instead of mine.