Last week I visited Docker con 2017 where Docker announced a whole lot of new features, under which a new feature in the docker build command, called multi staged builds.
These multi staged builds are extremely convenient to create images that are of minimum size. I am mostly using Docker on Windows, but this feature works on any version of Docker. When using Windows images, you might have noticed they are pretty large in size. Making your image as small as possible makes a big difference. So I will show you, based on the example I have used multiple times, how to create an optimized image to run an existing ASP.NET MVC 4.x on Windows Server Core.
When you create a new docker image that is part of a container composition that you want to run on one and the same host, you can run into the issue that the independent containers are not able to reach each other via DNS resolving.
So lets assume you have the following compose file where you want the web tier to be able to reach the database tier given the following compose file:
The past few days I worked quite a lot with docker-compose on my windows machine and after something strange happened to my machine that crashed it, I was not able to start any containers anymore that had connectivity over the network with each other.
Every time I used the command-line docker-compose up, I would get a message telling me it failed to start the container. the full message I got was:
“ERROR: for web Cannot start service web: failed to create endpoint aspnetblogapplication_web_1 on network nat: HNS failed with error : Unspecified error”
In my previous post I showed you how you can create a docker container image that has an ASP.NET 4.5 website running on the full .NET framework. In this post I want to show you how you can use VSTS build V-next and the release management tools to leverage the docker technology.
At the moment of this writing you can search the internet on ASP.NET and docker and all you will find is how to deploy ASP.NET Core applications to a Linux docker container. Although I love the initiative of ASP.NET core, I do believe that ASP.NET 4.5 is something many of you know and love already and nobody talks about how we can leverage docker on windows to run this full version of ASP.NET
To get you started we need to have a Windows version that is capable of natively running docker. With natively running docker I mean that docker is build into the OS. So no use of docker for windows tools, since we don’t want Linux containers, we want to run windows containers! At this moment you can use Windows 10 Anniversary edition and Windows Server 2016 Technical Preview 5 to go through the steps that I describe here to get your ASP.NET 4.5 website running in a docker on windows container.