I have 3 types of components in my docker app:
- database container
- database migrations container (creates and updates schema, used on production)
- database seeding (used on dev only)
When trying to run all of these services in docker compose I have a problem of ordering. I need database to be available, then migrations applied, then seed - in that exact order.
Simple docker compose up brings all services at once, so they fail because they cannot connect to database. On the other hand using docker compose up instead of calling docker run automatically brings services down.
How I can start my services, so they:
- Are run with docker
- Are started in correct order, and are waiting for each other
- Can easily be composed down with simple ctrl+c?