Search code examples
djangopostgresqldockerdocker-composecookiecutter-django

How does cookiecutter django create database in docker container/image


How does running docker-compose -f local.yml up create the postgres database in the postgres container with configurations in .envs/.local/.postgres. I have looked through the Dockerfiles and cannot seem to find a command such as createdb except in the maintenance/restore file.

Cookiecutter-django: https://github.com/pydanny/cookiecutter-django


Solution

  • The cookie cutter sets the environment variables which are then read by the Docker image. See Section How to extend this image > Environment Variables in the official docs: https://hub.docker.com/_/postgres