Demonstrating Docker-Ready Solution for Django & PostgreSQL

Tested Infrastructure

Platform Number of Instance Reading Time
Play with Docker 1 5 min



Follow the below instructions.

  1. Cloning the Repository
git clone
cd dockerlabs/solution/django-postgres/

Running Docker container

docker-compose run web startproject composeexample .

Once you run the above command, you might see containers coming up and running. Soon you will see port:8080 getting displayed on the top of PWD screen. Once clicked it might throw an error

"DisallowedHost at /
Invalid HTTP_HOST header: ''. You may need to add '' to ALLOWED_HOSTS."

To fix this issue, follow the below steps:

  1. Now there will be below folders and files present inside project folder

Configuring the settings

Inside composeexample/, Add below line at the end of the file. please change FQDN,IP according to your system.

ALLOWED_HOSTS = ['', 'localhost', '', '']

Edit the composeexample/ file and Replace the DATABASES = … with the following and save the file

 'ENGINE': 'django.db.backends.postgresql',
 'NAME': 'postgres',
 'USER': 'postgres',
  'HOST': 'db',
  PORT': 5432,

Brining up the Application Stack

Now it’s time to bring up Application Stack flawlessly.

curl "


Balasundaram Natarajan