Ashwin's Blog

Ashwin's Blog

How to Dockerize your ASP.NET Core app directly from Visual Studio

How to Dockerize your ASP.NET Core app directly from Visual Studio

Subscribe to my newsletter and never miss my upcoming articles

In this article we will see how to add docker support to ASP.NET core app directly from Visual Studio with just 3 Clicks without manually creating or writing any code to Dockerfile.

  1. Navigate to the Solution Explorer of your project and
    Right-click on the ASP.NET project -> Select Add -> Click Docker Support Add Support Edited.png
  2. Choose the Target OS where the docker image will run Windows / Linux, and click OK Target OS.png
  3. Visual Studio will create a Dockerfile for you, which specifies how to create the container image for your ASP.NET Core app project. Dockerfile.png

  4. Click on the Docker button to build the image and run it inside a Docker container, rather than in IIS Express. Docker Run.png Running WebAPP Edited.png

  5. You could verify that your container is running using the Docker command-line tools; open a cmd or Terminal and type in docker container ls to view the containers. Docker Container ls.png

That's it, you have successfully added Docker support to your ASP.NET core app and your app is now running inside a Docker container.

 
Share this