CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2022
    Posts
    7

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

    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

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,278

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

    Well, this is
    Forum: C-Sharp Programming
    Post questions, answers, and comments about C#.
    So is you post a question, an answer, or a comment?
    Victor Nijegorodov

  3. #3
    Join Date
    Mar 2022
    Posts
    7

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

    I have posted steps to create new .NET Core application

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,278

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

    Would you consider to move your ppost to one of the FAQ forums like
    https://forums.codeguru.com/forumdisplay.php?78-C-FAQs
    or
    https://forums.codeguru.com/forumdis...specific)-FAQs
    Victor Nijegorodov

  5. #5
    Join Date
    Mar 2022
    Posts
    7

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

    I have posted two articles on codeguru, it shows up in threads but not as an article.

    Wondering how to get this posted under the article section?

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,278

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

    Quote Originally Posted by srilatha0515 View Post
    I have posted two articles on codeguru, it shows up in threads but not as an article.

    Wondering how to get this posted under the article section?
    But why don't you want to post it in a FAQ section?
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured