MVC Net Core with Docker Containers Benefits

2019-06-10 16:19发布

问题:

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.

回答1:

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/

Some of the advantages are:

  • Portability: You can take a known to work image and put it in another environment (dev/testing/staging/production)
  • Isolation from the host system
  • Scalability: Take the app container to a cloud provider and run instances based on load

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.