Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dockerize ASP Classic on IIS

Tags:

Microsoft has been investing in running docker on windows with Docker Desktop for Windows. Is it possible to run a legacy ASP Classic application on IIS through Docker? How?

https://hub.docker.com/r/microsoft/iis/

like image 975
Patrick Lee Scott Avatar asked Oct 18 '16 04:10

Patrick Lee Scott


People also ask

Can you Dockerize .NET application?

Containerizing a . NET application is easy. You can do this by copying source code files and building a Docker image.

Can Docker run IIS?

docker run -p 8080:80 your_docker_handler for example. Hence you can access you IIS using http://server-ip and for docker http://server-ip:8080. or else, You can do reverse proxy from IIS to your docker if you want to access docker without the port.

Can I Dockerize Windows?

Windows includes its own container technology. Like many Windows Server features, Docker for Windows can be installed either using PowerShell or using Windows feature dialog.

Can we Dockerize any application?

You can use Docker to pack your application with everything you need to run the application (such as libraries) and ship it as one package - a container. Containers are created from images that specify their precise contents. Dockerizing is a big hit nowadays.


1 Answers

I finally got this all working. It was a lot more complex than running a simple Dockerfile, as it was a site that was originally developed in 2002. There were modules that had to be downloaded and installed, web.config sections that needed to be unlocked, and ODBC data connections that had to be made. My final docker file looked like this - hope it helps the next person!

# escape=`  FROM mcr.microsoft.com/windows/servercore/iis SHELL ["powershell", "-command"]  RUN Install-WindowsFeature Web-ASP; `     Install-WindowsFeature Web-CGI; `     Install-WindowsFeature Web-ISAPI-Ext; `     Install-WindowsFeature Web-ISAPI-Filter; `     Install-WindowsFeature Web-Includes; `     Install-WindowsFeature Web-HTTP-Errors; `     Install-WindowsFeature Web-Common-HTTP; `     Install-WindowsFeature Web-Performance; `     Install-WindowsFeature WAS; `     Import-module IISAdministration;  RUN md c:/msi;  RUN Invoke-WebRequest 'http://download.microsoft.com/download/C/9/E/C9E8180D-4E51-40A6-A9BF-776990D8BCA9/rewrite_amd64.msi' -OutFile c:/msi/urlrewrite2.msi; `     Start-Process 'c:/msi/urlrewrite2.msi' '/qn' -PassThru | Wait-Process;  RUN Invoke-WebRequest 'https://download.microsoft.com/download/1/E/7/1E7B1181-3974-4B29-9A47-CC857B271AA2/English/X64/msodbcsql.msi' -OutFile c:/msi/msodbcsql.msi;  RUN ["cmd", "/S", "/C", "c:\\windows\\syswow64\\msiexec", "/i", "c:\\msi\\msodbcsql.msi", "IACCEPTMSODBCSQLLICENSETERMS=YES", "ADDLOCAL=ALL", "/qn"];  EXPOSE 8000 RUN Remove-Website -Name 'Default Web Site'; `     md c:\mywebsite; `     New-IISSite -Name "mywebsite" `                 -PhysicalPath 'c:\mywebsite' `                 -BindingInformation "*:8000:";  RUN & c:\windows\system32\inetsrv\appcmd.exe `     unlock config `     /section:system.webServer/asp  RUN & c:\windows\system32\inetsrv\appcmd.exe `       unlock config `       /section:system.webServer/handlers  RUN & c:\windows\system32\inetsrv\appcmd.exe `       unlock config `       /section:system.webServer/modules  RUN Add-OdbcDsn -Name "mywebsite" `                 -DriverName "\"ODBC Driver 13 For SQL Server\"" `                 -DsnType "System" `                  -SetPropertyValue @("\"Server=XXXX.us-east-2.rds.amazonaws.com\"", "\"Trusted_Connection=No\"");  ADD . c:\mywebsite 
like image 197
Patrick Lee Scott Avatar answered Oct 25 '22 11:10

Patrick Lee Scott