I have been reading up and learning about Docker, and am trying to correctly choose the Django setup to use. So far there is either:
I understand that Dockerfiles
are used in Docker Compose
, but I am not sure if it is good practice to put everything in one large Dockerfile with multiple FROM
commands for the different images?
I want to use several different images that include:
uwsgi
nginx
postgres
redis
rabbitmq
celery with cron
Please advise on what are best practices in setting up this type of environment using Docker.
If it helps, I am on a Mac, so using boot2docker.
Some Issues I've had:
A Dockerfile is a simple text file that contains the commands a user could call to assemble an image.
Example, Dockerfile
FROM ubuntu:latest
MAINTAINER john doe
RUN apt-get update
RUN apt-get install -y python python-pip wget
RUN pip install Flask
ADD hello.py /home/hello.py
WORKDIR /home
Docker Compose
is a tool for defining and running multi-container Docker applications.
define the services that make up your app in docker-compose.yml
so they can be run together in an isolated environment.
get an app running in one command by just running docker-compose up
Example, docker-compose.yml
version: "3"
services:
web:
build: .
ports:
- '5000:5000'
volumes:
- .:/code
- logvolume01:/var/log
links:
- redis
redis:
image: redis
volumes:
logvolume01: {}