具有Docker容器的MVC Net Core的好处 [英] MVC Net Core with Docker Containers Benefits

查看:172
本文介绍了具有Docker容器的MVC Net Core的好处的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#后端和ASP CSS / html / Razor前端创建一个简单的MVC Net Core应用程序。这是一个简单的开始项目,客户可以在其中创建订单,购买书籍并放入购物车中。 Docker映像将如何支持这一点?

I am creating a simple MVC Net Core app with C# backend, and ASP CSS/html/Razor front end. It is a simple start project where customers can create orders, buy books, and place into a shopping cart. How would Docker images support this? Or would this be an overkill for MVC.

推荐答案

这不是过度杀伤力。它实际上非常简单,并且Docker化带来了很多优势。例如,阅读Docker文档上的.Net Core dockerization页面: https://docs.docker。 com / engine / examples / dotnetcore /

It's not overkill. It's actually quite simple and the dockerization brings a lot of advantages. Read for example the .Net Core dockerization page on Docker docs: https://docs.docker.com/engine/examples/dotnetcore/

其中一些优势是:


  • 可移植性:您可以拍摄已知的工作映像并将其放置在另一个环境(开发/测试/登台/生产)

  • 与主机系统的隔离

  • 可扩展性:将应用程序容器带到云提供商并根据负载运行实例

您必须考虑关于持久性:您不应该将数据存储在Docker容器中,因为在删除容器时,这些数据很容易丢失。通常,您在应用程序容器旁边启动一个数据库容器,并将其数据存储在卷中或主机文件系统中。

You have to think about persistance: You shouldn't store data in the docker container because this can easily be lost when removing the container. Usually you start a database container next to your app container and store it's data in a volume or on the host filesystem.

这篇关于具有Docker容器的MVC Net Core的好处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆