Dockerfiles to create images for use in local Django development environments.
Designed to be used with Docker Compose, it will make things a lot easier.
I took most of these Dockerfiles from existing projects and modified them to work for my setup.
- base - Ubuntu 16.04 with commonly used packages for Django/Python development.
- postgresql - PostgreSQL 9.6 database (default username/password is docker/docker).
- django - Not much difference from the base image except port 80 is exposed and contains a few additional packages/libraries.
- rabbitmq - RabbitMQ message broker usually used with Celery.
- Under
volumes:
, local directories are mapped to the containers. It expectsdocker-compose.yml
to be in the root project directory. Python packages are also mapped from the local directory to make the image more reusable (i.e. no need to rebuild the images every time you add a new package to your project). - For the
youtube-audio-dl
project, themanage.py
file is in the project root, that's why I set that path as theworking_dir
. - You can run Django management commands inside the
django
container by prependingdocker-compose run django
(e.g.docker-compose run django python manage.py migrate
). - By default, everything run as
root
in the Docker containers. - The
sleep
part in the command is to make sure the PostgreSQL service is ready to accept the connections before running a command that depends on it (see docker/compose#374).