The docker-compose.yml file¶
Important
The docker-compose.yml
in Divio Cloud projects builds a web
service ina container using its . It also builds a db
service, from astandard postgres:9.4
image.
The first definition in the file is for the service. In order, thedirectives mean:
- build: build it from the Dockerfile in the parent directory
- links: link to the database container
- volumes:
- map the parent directory on the host to /app in the container, withread and write access
- command: by default, when the command docker-compose run is issued,execute python manage.py runserver 0.0.0.0:80
- env_file: use the .env-local to supply environment variables to thecontainer
The second definition is for thedb
service. On the Cloud, the project’sdatabase runs on an AWS server; locally, it runs on a Postgres instance indb
.
- volumes: map the parent directory on the host to /app in thecontainer, with read and write access
See Expose the database’s port for an example of adding configuration todocker-compose.yml
.