Migrating from VirtualEnv to Docker
@PabloVallejo
@PabloVallejo_
tappsi.co
What is Docker?
An open platform for distributed applications
A configurable Lightweight and Fast Virtual Machine
Use Cases
Distributed Systems
Microservices
Development Environments
Project setup
From: https://speakerdeck.com/asm89/docker
Usual setup
Now
Docker Toolbox
Folder structure
docker-django/
├── app/
├── __init__.py
├── local_settings.py
├── settings.py
├── urls.py
├── view.py
└── wsgi.py
├── Dockerfile
├── docker-compose.yml
├── manage.py
└── requirements.txt
App settings
Django commands
Dependencies
Docker setup files
FROM python:3.5.1
RUN apt-get update
RUN easy_install -U pip
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/requirements.txt
RUN pip install -r requirements.txt
# FROM: Get image from docker index
# RUN: Run commands inside container
Dockerfile
db:
image: postgres:9.5.0
volumes:
- .:/tmp/data/
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
links:
- db
# Django server
# Share this folder
# Get Postgres image
docker-compose.yml
# Build project
docker-compose build
Compose commands
# Run project
docker-compose up
Demo
PabloVallejo/docker-django
We're hiring!
Django/Flask
Ruby/Elixir
Microservices
Questions
From VirtualEnv to Docker in Django
By pablovallejo
From VirtualEnv to Docker in Django
How to setup Django projects using Docker
- 2,453