Introduction
Let’s have a brief recap before proceeding. Suppose, we as developers have created an application. When we create a container image for our application, we pack up our code, as well as all its dependencies and tools needed to run it as a container. The advantage is that when we run this image as a container, it will run the same way as it did on our development machine. This is because the application will use the same set of resources irrespective of which machine we run it as a container on. When we run an application as a container, it will run the same way everywhere. Docker is a tool that helps us deal with creating and running containers. Again if you still have any doubts regarding containers touch base with my article here. Also in my earlier article, we created a virtual machine on Azure and deployed our container there. You can also run containers on Azure as ACI’s (Azure Container Instances). Let’s learn how.
What are Azure Container Instances?
Using ACI’s, you can simply run your containers on Azure. The advantage is you can run it for a particular amount of time and then stop the container. You will just be billed for the time your container runs. It’s really easy to use.
Creating a virtual machine
ACI works better with images created with Windows 2016 systems rather than with Windows 10 systems. So, I created a Windows 2016 virtual machine on Azure.

When you create a virtual machine, be careful of the disk size that you choose. Not all disk sizes support double virtualization. Also, you need to allow all RDP connections to be able to connect to Azure.
Once the virtual machine is created, we would want to install Visual Studio 2017 and Docker for Windows Community Edition next. But the thing is that servers have very strict security policies, especially when you try to browse through Internet Explorer. So, I downloaded Chrome.exe on to my actual system and then copied it to my virtual machine. I then installed Chrome on my virtual machine and later, using Chrome, installed Visual Studio 2017 & Docker for Windows.
Once all the installations are done, let’s create an application as below.
Creating an application
Create a new ASP.NET MVC core project in Visual Studio 2017. While creating make sure you have the ‘Enable Docker Support’ option checked.
I call my app ‘aspnetapp’. Once you enable docker support, a file called dockerfile is created in the solution explorer.

Replace the existing code in this file with the following piece of code.
- FROM microsoft/dotnet:sdk AS build-env
- WORKDIR /app
- # Copy csproj and restore as distinct layers
- COPY *.csproj ./
- RUN dotnet restore
- # Copy everything else and build
- COPY . ./
- RUN dotnet publish -c Release -o out
- # Build runtime image
- FROM microsoft/dotnet:aspnetcore-runtime
- WORKDIR /app
- COPY --from=build-env /app/out .
- ENTRYPOINT ["dotnet", "aspnetapp.dll"]
















Rajesh KakiPosted Sep 9, 2019, 1:43 AM
Tuba Mansoor, I created a winser 2016 VM and when I try to install docker for windows, it errored out saying windows 10 pro or higher version is needed. Can you tell me how you installed it. Thanks.
Kapil Singh KumawatPosted Mar 19, 2019, 9:56 AM
Good article