Kumar Ashwin Hubert
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

Kumar Ashwin Hubert's photo
Kumar Ashwin Hubert
·Mar 7, 2021·

2 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

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.

Did you find this article valuable?

Support Kumar Ashwin Hubert by becoming a sponsor. Any amount is appreciated!

Learn more about Hashnode Sponsors
Share this