This project is a base for developing a Django application with Docker. It consists of the following services and containers:
Service | Container | Port | URL |
---|---|---|---|
Gunicorn | django |
8000 | http://localhost:8000 |
Nginx | nginx |
8080 | http://localhost:8080 |
PostgreSQL | postgres |
5432 | psql -h localhost |
Redis | redis |
6379 | redis-cli -h localhost |
In addition to using Docker, the intended Docker host operating system is CoreOS. In order to work with CoreOS locally, we use a CoreOS Vagrant box, so you'll need to download and install Vagrant.
Lastly, you'll need docker-compose
, which is a tool for defining and running multi-container applications with Docker.
$ pip install docker-compose
Bring up the CoreOS Docker host with:
$ vagrant up
After the machine is up, you must set DOCKER_HOST
to the Vagrant host-only interface IP:
$ export DOCKER_HOST=tcp://172.17.8.100:2375
Next, we need to build any containers with an associated Dockerfile
with docker-compose
:
$ docker-compose build
Once that's complete, use docker-compose
again to bring up the environment:
$ docker-compose up