I am creating a Python + Django development environment using docker. I defined Dockerfile files and services in the docker-compose.yml containers for the web server (nginx) and the database (postgres) and the container that will run our application using uwsgi. Since this is a dev environment, I am mounting the application code from the host system, so I can easily edit it in my IDE.
I have a question where / how to execute the migrate command.
In case you do not know Django, the migrate command creates a database structure and then changes it as necessary to the project. I have seen people start migrations as part of the compose command command: python manage.py migrate && uwsgi --ini app.ini, but I don't want migrations to start every time the container is reloaded. I just want it to start once when I create containers and never start again until rebuild.
Where / how can I do this?
Edit: There is an open problem in the development team. If you're lucky, command containers will get support at one time. https://github.com/docker/compose/issues/1896
source
share