Dependencies for an application
• Windows 10 is required for Docker installation.
• Visual Studio 2017 or higher has built-in support for Docker, so this is highly recommended.
• .NET Core SDK
• Docker for Windows
• Docker Tools

Why should we use microservices instead of a monolithic approach?
Microservices is an approach to develop small services that each run in its own process. We should develop microservices instead of one service (a monolithic approach) for a multitude of benefits, including:

Microservices are smaller in size
Microservices are easier to develop, deploy, and debug, because a fix only needs to be deployed onto the microservice with the bug, instead of across the board
Microservices can be scaled quickly and can be reused among different projects
Microservices work well with containers like Docker
Microservices are independent of each other, meaning that if one of the microservices goes down, there is little risk of the full application shutting down.

Why should we use .NET Core?
.NET Core is a great development tool for many reasons, including that it’s open source and is very helpful in developing high-performance and scalable systems. It supports cross-platform runtime, so if one can create a service using .NET Core, it can be run on any platform. .NET Core is also helpful for faster development, as well as supporting built-in dependency injection and a cloud-based environment configuration. .NET Core also has Docker support.

Why should we use Docker?
Docker is a tool that makes it easier to create, deploy, and run applications by using a containerization approach. These containers are lightweight and take less time to start than traditional servers. These containers also increase performance and lower cost, while offering proper resource management. Another benefit to using Docker is that a user no longer need to pre-allocate RAM to each container.

How to create a new application using .NET Core and then build and run it using Docker

Step 1: Open Visual Studio 2019, then create a new project
Name:  Image1.jpg
Views: 83
Size:  13.5 KB

Step 2: Select ASP.Net Core Web App, then click on NextName:  Image2.jpg
Views: 50
Size:  14.3 KB

Step 3: Provide the Project Name and Location to save the projectName:  Image3.jpg
Views: 76
Size:  10.4 KB

Step 4: Select Target Framework as ".Net Core 3.1" or higher. Also Enable Docker Checkbox then click on "Create"
Step 5(optional): Once the project is created it will prompt to Install Docker, if the Docker is not installed on the machine yetName:  Image4.jpg
Views: 76
Size:  11.4 KB

Step 6: Solution will be created with a Dockerfile in the file list

Step 7: Build the solution, application will open in the browser

Step 8: To check the docker images, cmd to the project folder and type the command "docker images"

Here are some of the commands for the docker imagesName:  Image7.jpg
Views: 78
Size:  27.6 KB

To restore packages: dotnet restore

To publish the application code: dotnet publish -o obj/Docker/publish

To build the image: docker build -t imagename

Check running containers: docker ps

Check all containers: docker ps -a