1. Create a new Django Project:
django-admin startproject blog_docker_django

2. Create a ‘Dockerfile’ file in root directory:

From python:3.6

WORKDIR /app

COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt

COPY . /app
EXPOSE 8000
CMD python manage.py runserver 0.0.0.0:8000

3. Create ‘docker-compose.yaml’

version: '2'
services:
web:
build: .
ports:
- "8000:8000"
volumes:
- .:/app

4. Generate ‘requirements.txt’

pip freeze > requirements.txt

5. Create Docker image and run Container:

docker-compose up --build