Docker and CI/CD · Senior · Question 67 of 75
What's the risk of running migrations in an init container of a Deployment with several replicas?
- ✓Correct answer: Each replica runs them at once, so they may race
- 2Init containers can't connect to databases at all
- 3Migrations in init containers always roll back
Explanation
Use a migration tool with a lock, or run migrations as a separate Job (or pipeline step) before rolling out the new version.