在IIS上Dockerize ASP Classic

微软一直在投资在Windows上运行docker。 是否有可能通过Docker在IIS上运行传统的ASP Classic应用程序? 怎么样?

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

我终于得到了这一切工作。 这比运行一个简单的Dockerfile复杂得多,因为它是一个最初在2002年开发的站点。有一些模块需要下载和安装,需要解锁的web.config部分以及ODBC数据连接必须被制造。 我的最终docker文件看起来像这样 – 希望它有助于下一个人!

# escape=` FROM microsoft/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 

我还没有尝试过,但运行传统ASP不应该是一个问题。 microsoft/iis映像基于microsoft/windowsservercore映像,这是一个完整的服务器核心安装,并且还包括32位支持。

ASPfunction默认不会在那里,所以你的Dockerfile将不得不像这样开始:

 # escape=` FROM microsoft/iis SHELL ["powershell", "-command"] RUN Install-WindowsFeature Web-ASP 

escapeSHELL行只是使构buildWindows友好的Dockerfiles更容易,请参阅Windows,Dockerfiles和Backtick Backslash Backlash )。

然后,您将在您的ASP应用程序文件夹中进行复制,然后使用PowerShell命令运行其余的IIS设置。 这个问题有一些很好的指针, 这个ASP.NET应用程序的Dockerfile显示了如何使用PowerShell来configuration网站。

Interesting Posts