[英]Apply EF migration using the Kubernetes init containers
I want to migrate an Asp.Net Core app on Kubernetes.我想在 Kubernetes 上迁移 Asp.Net Core 应用程序。 Actually, inside the
Program.cs
class, there is the code that executes the migrations in the following way:实际上,在
Program.cs
class 中,有如下代码执行迁移:
context.Database.Migrate();
I would like to remove this from the application startup and create a Docker image to use as the base image for the application init container.我想从应用程序启动中删除它并创建一个 Docker 图像作为应用程序初始化容器的基础图像。
Any suggestion?有什么建议吗?
You have at least two options to run the migrations separately from the application.您至少有两个选项可以独立于应用程序运行迁移。
Hope it helps, it doesn't describe how to run either option before your app but I think you can use the kubernetes into container to run any container before the others.希望它有所帮助,它没有描述如何在您的应用程序之前运行任何一个选项,但我认为您可以在容器中使用kubernetes在其他容器之前运行任何容器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.