In today's article, we will create an ASP.NET Core 2.0 MVC web application with Docker support and then, we will deploy our application in a Docker container (Windows 10).
Why do we need this?
The main purpose of Docker is to deploy applications to the production environment or other environments as required by Ops. However, the highlight of Docker lies in the process of deploying it.
Till Docker came into the picture, the traditional approach to deployment was via Virtual Machines (VM). And let’s not get started with the drawbacks of VMs because there are a plenty. Starting from the effort required to boot a VM, to launching multiple VMs in the same machine, it is a tough task to get things running with VMs.
So first, let’s see what does Docker provide?
Docker provides a container environment which can be used to host any application of your choice. The software application and the dependencies which support it are tightly-packaged together.
This packaged product is called a Container. Since it is done by Docker, it is called a Docker container!
Benefits of Docker container?
Since the application and its dependencies are packaged together, there is no external dependency for the app to run. This means the container is very light-weight.
Because it is light-weight, it can be easily shipped to other machines and be executed on those machines, irrespective of their host OS/ configurations.
The only requirement being, Docker has to be installed to run that application residing in the container.
So let's get started.
We will install docker for windows (we are using windows 10).
For that go to the following link - https://store.docker.com/editions/community/docker-ce-desktop-windows
You will need to login in order to download this. Once you have downloaded the setup and installed then restart your system.
After restarting go to command prompt and type docker version
You should see something like this in your console.

It means that docker is successfully installed in your machine. Now we will create our ASP.NET Core 2.0 MVC application.


Make sure to check Enable Docker Support checkbox and select your OS (mine is windows)
Once the project is created then you will see some docker files in the solution explorer,

When we open Dockerfile,











Joginder BangerPosted May 6, 2020, 7:39 AM
Hi bro, I want the deploy docker image on windows server. can you tell me what is the procedure. thanks joginder
Amit Kumar PalPosted Sep 8, 2019, 11:39 PM
Hi Ravi, thanks for sharing, good explained...
Vishal KadamPosted Feb 14, 2019, 4:20 PM
HI Ravi, Thank you for this article.
Vishal DobariyaPosted Jul 30, 2018, 8:30 PM
Hi Ravi, When we say that application is running on Docker container in your example, Where exactly it is running? On your local windows box or somewhere on the internet cloud? Looking at IP address, it seems it's not the local box IP.
Farhan AhmedPosted Jul 24, 2018, 12:56 AM
Like it nice one
Faisal PathanPosted Jul 15, 2018, 10:59 PM
Thank you for sharing
Viknaraj ManogararajahPosted Jul 14, 2018, 10:44 PM
Nice Article, Thank you for sharing.........
Hadshana KamalanathanPosted Jul 14, 2018, 6:47 PM
Thanks for sharing
Avinash JorigePosted Jul 14, 2018, 2:40 AM
Hi Ravi, this article is good and helped me a lot, thanks.
Ravishankar NPosted Jul 13, 2018, 1:09 PM
Nice article. Thanks fot sharing
Ashish ChristianPosted Jul 13, 2018, 5:38 AM
Hi Ravi, Thanks for this article. I have run docker-compose build this command but I got an error *ERROR: Service 'test01' failed to build: error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/5f/5fef67803e08bc5f4f5aadc73ccc099e05feda1f4aad6ee2ece423bc3a332b61/data?verify=1531481150-P5kdGsjQSpFsfK8d6B8c10mSMfg%3D: dial tcp 104.18.125.25:443: i/o timeout* Here test01 is my project name.