How To Add Docker Support For Existing ASP.NET Project

In this article we will learn how to add docker support for existing ASP.NET  or any .NET application, before enabling docker support let's know about the docker in brief

What is Docker?

Docker is one of the platform for containerizing the applications which allows to deliver the application in packages over the operating machine level virtualization. Docker allows to run and create the images in Linux and windows containers etc.

Step 1: Install Prerequisites

You need to install the docker client based on your operating system on your machine. you can download the docker by using the following link

The installed docker desktop client will be look like as shown in the following image, 

Hope you installed the prerequisites.

Step 2: Open Existing Application

Open your existing application in visual studio as shown in the following image

Docker client helps to create and run the docker images locally as well as created images you can push in to the any image container registry such as ACR or docker hub.

Step 3: Add Docker Support

Now right click on the solution explorer of your existing project and follows the steps which are shown in the following image

Once you click on the Docker Support option , It will prompt the screen which is shown in the step 4.

Step 4: Choose the Container

Choose the target operating system on which type of container you wants to run the application. Let's choose the Linux option which creates the image size smaller than windows container image.

In the preceding image click on the OK button, it will create the Docker file in your project solution as shown in the following image

Step 5: Open the Docker File

Now double click on docker file, it has following auto generated code from visual studio which has pre-configured steps to create and run the docker image 

Step 6:  Run the image in Docker Container

Choose the docker option to run the application as shown in the following image

After clicking on docker option, application runs inside the docker container as shown in the following image

Now our application running inside the Docker container instead of IIS express.


This tutorial is for beginner so there is no command line tool used to build , run the docker container images in this tutorial. The intend of this tutorial to make familiar to beginners about docker and let them know docker is not difficult to learn.


I hope the preceding article is useful to understand how to enable the docker support for existing ASP.NET project with less efforts.

If you like my efforts and intend then support me by subscribing my YouTube Channel and blog by using the following links

Post a Comment

Protected by Copyscape
Copyright © Compilemode