If you are reading this and trying to build container for your asp.net 4.5 applications, here are the steps: In order to explain the process, we’ll assume our application is called LegacyApp. A typical asp.net 4.5 application.
- We will install Docker host on windows.
- Create a directory (i.e. C:\package) that will contain all the files needed to build the container.
- Create the web deploy package of the project from Visual studio. The following images hints the steps we need to follow.
Image: Use 'Web Deploy Package' option
Important note: We should name the site in the following format Default Web Site\LegacyApp to avoid more configuration works.
- Download the WebDeploy_2_10_amd64_en-US.msi from Microsoft web site
- I have ran into an ACL issue while deploying the application. Thanks to the author of FluentBytesarticle, that provides one way to solve the issue by using a powershell file during the installation. We will create that file into the same directory, let’s name it as fixAcls.ps1. The content of the file can be found here
- We will create the dockerfile into the same directory, with the content of this sample dockerfile
At this moment our package directory will look somewhat following:
- Now we will go to the command prompt and navigate the command prompt to the directory (i.e. C:\package) we worked so far.
- Build the container
c:/> docker build -t legacyappcontainer .
- Run the container
c:/> docker run -p 80:80 legacyappcontainer
- We will run the inspect command to see the container IP.
C:\> docker -inspect < image guid >
- Now we will take the IP from the JSON and use the IP on our URL to navigate to the application.