Skip to main content

Command Palette

Search for a command to run...

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

Published
2 min read
How to Dockerize your ASP.NET Core app directly from Visual Studio
K

I'm a software consultant who loves to build projects and share my learnings on this blog.

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.

More from this blog

A

Ashwin's Blog

23 posts

I'm a software consultant who loves to build projects and share my learnings on this blog.