SlideShare a Scribd company logo
Django + Docker
Super easy setup
https://github.com/brendenwest/django-demo
Installation & Docs
- Overview : https://docs.docker.com/engine/understanding-docker/
- Django images: https://hub.docker.com/_/django/
- Django quickstart: https://docs.docker.com/compose/django/
- MySQL images: https://hub.docker.com/r/mysql/mysql-server/
Terminology
Docker containers wrap a piece of software in a complete filesystem that contains
everything needed to run: code, runtime, system tools, system libraries – anything
that can be installed on a server.
- Image - A binary image with stacked read-only layers representing file system
differences.
- Container - A running instance of a Docker image, with a thin, writable layer
for all changes made to the container - such as writing new files, modifying
existing files, and deleting files. When the container is deleted the writable
layer is also deleted.
Django via Docker
Microservices - Linked Single-purpose Containers
Docker Host
Django
Container
DB
Container
Dev Process Overview
One time
1. Install virtualbox
2. Install Docker
Per Project
1. Create project directory
2. Start docker machine
3. Create Docker image for Django 1
4. Create MySQL docker image 1
5. Create initial Django project 2
6. Update settings.py database config
7. Start Docker container(s)
1 - Can be one-time step if project doesn’t require image customization
2 - if project doesn’t already exist
Creating a Django image
Create the following files:
Dockerfile - Django image specifications
Requirements.txt - python environment specifications
docker-compose.yml (optional) - Django container runtime settings
Image can be created via command line or docker-compose.yml:
$ docker build -t <IMAGE_NAME> .
$ docker-compose up -d
Creating a DB image
Optional - You can use Django image default settings instead
DB can be any valid Django data store (SQLite, MySQL, PostgreSQL)
DB can be specified in docker-compose.yml, or via dedicated Dockerfile
Django container needs to reference ports exposed by DB container
DB data storage can be packaged in container or on external ‘volume’
Useful Docker Commands
docker-machine start
eval "$(docker-machine env default)"
docker-machine ip
docker-compose up
docker-compose up -d
docker ps
docker exec -it <container> bash
docker start/stop <container>

More Related Content

What's hot (20)

PDF
Rapid Development With Docker Compose
Justin Crown
 
PPTX
Docker toolbox
Yonghwee Kim
 
PDF
Docker up and running
Victor S. Recio
 
PDF
Ansible docker
QNIB Solutions
 
PDF
Docker Started
Victor S. Recio
 
PDF
Docker by Example - Basics
CodeOps Technologies LLP
 
PDF
Dockerfile
Jeffrey Ellin
 
PDF
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Erica Windisch
 
PDF
Docker
SangtongPeesing
 
PPTX
Architecting .NET Applications for Docker and Container Based Deployments
Ben Hall
 
PDF
Introduction to docker
Walid Ashraf
 
PPTX
Develop with docker 2014 aug
Vincent De Smet
 
PDF
Docker and Containers for Development and Deployment — SCALE12X
Jérôme Petazzoni
 
ODP
Docker - The Linux Container
Balaji Rajan
 
PPTX
Austin - Container Days - Docker 101
Bill Maxwell
 
PDF
The state of the swarm
Mathieu Buffenoir
 
PDF
How to Improve Your Image Builds Using Advance Docker Build
Docker, Inc.
 
PDF
Introduction to Docker and deployment and Azure
Jérôme Petazzoni
 
PDF
A Hands-on Introduction to Docker
CodeOps Technologies LLP
 
PDF
Docker by Example - Quiz
CodeOps Technologies LLP
 
Rapid Development With Docker Compose
Justin Crown
 
Docker toolbox
Yonghwee Kim
 
Docker up and running
Victor S. Recio
 
Ansible docker
QNIB Solutions
 
Docker Started
Victor S. Recio
 
Docker by Example - Basics
CodeOps Technologies LLP
 
Dockerfile
Jeffrey Ellin
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Erica Windisch
 
Architecting .NET Applications for Docker and Container Based Deployments
Ben Hall
 
Introduction to docker
Walid Ashraf
 
Develop with docker 2014 aug
Vincent De Smet
 
Docker and Containers for Development and Deployment — SCALE12X
Jérôme Petazzoni
 
Docker - The Linux Container
Balaji Rajan
 
Austin - Container Days - Docker 101
Bill Maxwell
 
The state of the swarm
Mathieu Buffenoir
 
How to Improve Your Image Builds Using Advance Docker Build
Docker, Inc.
 
Introduction to Docker and deployment and Azure
Jérôme Petazzoni
 
A Hands-on Introduction to Docker
CodeOps Technologies LLP
 
Docker by Example - Quiz
CodeOps Technologies LLP
 

Viewers also liked (8)

PDF
Django and Docker
Docker, Inc.
 
PPT
24 Sata - Ne zaboravi titlove prezentacija (IT Showoff)
IT Showoff
 
PDF
ORM in Django
Hoang Nguyen
 
PDF
Python & Django TTT
kevinvw
 
KEY
Jumpstart Django
ryates
 
PDF
Deploying Django with Ansible
andrewmirskynet
 
PDF
Efficient Django
David Arcos
 
PPTX
AWS Elastic Beanstalk and Docker
Docker, Inc.
 
Django and Docker
Docker, Inc.
 
24 Sata - Ne zaboravi titlove prezentacija (IT Showoff)
IT Showoff
 
ORM in Django
Hoang Nguyen
 
Python & Django TTT
kevinvw
 
Jumpstart Django
ryates
 
Deploying Django with Ansible
andrewmirskynet
 
Efficient Django
David Arcos
 
AWS Elastic Beanstalk and Docker
Docker, Inc.
 
Ad

Similar to Django via Docker (20)

PDF
Docker and Django Meet For A Tango - London Meetup
frentrup
 
PDF
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
raccoony
 
PDF
Future of Development and Deployment using Docker
Tamer Abdul-Radi
 
PDF
dkr_django_slides
Gladson Manuel
 
PDF
Deliver Python Apps with Docker
Anton Egorov
 
PDF
Dockerize a Django app elegantly
frentrup
 
PDF
Keep it simple web development stack
Eric Ahn
 
PDF
Docker Up and Running for Web Developers
Amr Fawzy
 
PDF
Docker up and Running For Web Developers
BADR
 
PDF
Deploy django apps using docker
Thomas Kremmel
 
PPT
Docker 101, Alexander Ryabtsev
Tetiana Saputo
 
PPTX
Docker Ecosystem on Azure
Patrick Chanezon
 
PDF
Django for Professionals Production websites with Python Django 4 0 William S...
piipadinney
 
PPTX
Docker for everything
Tim Haak
 
PDF
Docker Introduction
Jeffrey Ellin
 
PPTX
Cont0519
Samuel Dratwa
 
PDF
Learning Docker with Thomas
Thomas Tong, FRM, PMP
 
PDF
Introduction to Docker at the Azure Meet-up in New York
Jérôme Petazzoni
 
PPTX
Dockerize the World - presentation from Hradec Kralove
damovsky
 
Docker and Django Meet For A Tango - London Meetup
frentrup
 
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
raccoony
 
Future of Development and Deployment using Docker
Tamer Abdul-Radi
 
dkr_django_slides
Gladson Manuel
 
Deliver Python Apps with Docker
Anton Egorov
 
Dockerize a Django app elegantly
frentrup
 
Keep it simple web development stack
Eric Ahn
 
Docker Up and Running for Web Developers
Amr Fawzy
 
Docker up and Running For Web Developers
BADR
 
Deploy django apps using docker
Thomas Kremmel
 
Docker 101, Alexander Ryabtsev
Tetiana Saputo
 
Docker Ecosystem on Azure
Patrick Chanezon
 
Django for Professionals Production websites with Python Django 4 0 William S...
piipadinney
 
Docker for everything
Tim Haak
 
Docker Introduction
Jeffrey Ellin
 
Cont0519
Samuel Dratwa
 
Learning Docker with Thomas
Thomas Tong, FRM, PMP
 
Introduction to Docker at the Azure Meet-up in New York
Jérôme Petazzoni
 
Dockerize the World - presentation from Hradec Kralove
damovsky
 
Ad

Recently uploaded (20)

PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PPTX
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
Executive Business Intelligence Dashboards
vandeslie24
 
Human Resources Information System (HRIS)
Amity University, Patna
 
Import Data Form Excel to Tally Services
Tally xperts
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 

Django via Docker

  • 1. Django + Docker Super easy setup https://github.com/brendenwest/django-demo
  • 2. Installation & Docs - Overview : https://docs.docker.com/engine/understanding-docker/ - Django images: https://hub.docker.com/_/django/ - Django quickstart: https://docs.docker.com/compose/django/ - MySQL images: https://hub.docker.com/r/mysql/mysql-server/
  • 3. Terminology Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. - Image - A binary image with stacked read-only layers representing file system differences. - Container - A running instance of a Docker image, with a thin, writable layer for all changes made to the container - such as writing new files, modifying existing files, and deleting files. When the container is deleted the writable layer is also deleted.
  • 5. Microservices - Linked Single-purpose Containers Docker Host Django Container DB Container
  • 6. Dev Process Overview One time 1. Install virtualbox 2. Install Docker Per Project 1. Create project directory 2. Start docker machine 3. Create Docker image for Django 1 4. Create MySQL docker image 1 5. Create initial Django project 2 6. Update settings.py database config 7. Start Docker container(s) 1 - Can be one-time step if project doesn’t require image customization 2 - if project doesn’t already exist
  • 7. Creating a Django image Create the following files: Dockerfile - Django image specifications Requirements.txt - python environment specifications docker-compose.yml (optional) - Django container runtime settings Image can be created via command line or docker-compose.yml: $ docker build -t <IMAGE_NAME> . $ docker-compose up -d
  • 8. Creating a DB image Optional - You can use Django image default settings instead DB can be any valid Django data store (SQLite, MySQL, PostgreSQL) DB can be specified in docker-compose.yml, or via dedicated Dockerfile Django container needs to reference ports exposed by DB container DB data storage can be packaged in container or on external ‘volume’
  • 9. Useful Docker Commands docker-machine start eval "$(docker-machine env default)" docker-machine ip docker-compose up docker-compose up -d docker ps docker exec -it <container> bash docker start/stop <container>