I have set up a Docker Django/PostgreSQL app closely following the Django Quick Start instructions on the Docker site.
The first time I run Django\'s manage.py migr
Have your stack running then fire off a one shot docker-compose run command. E.g
#assume django in container named web
docker-compose run web python3 manage.py migrate
This works great for the built-in (default) SQLite database, but also for an external dockerized database that's listed as dependency. Here's an example docker-compose.yaml file
version: '3'
services:
db:
image: postgres
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
https://docs.docker.com/compose/reference/run/