我们可以在windows容器上部署一个asp.net mvc 4应用程序到docker吗? [英] Can we deploy an asp.net mvc 4 app to docker with windows container?
问题描述
是的。
您可以使用 microsoft / windowsservercore
或 microsoft / iis
作为基础映像,安装完整的ASP.NET并在Windows上的容器中运行旧版.NET应用程序。您现在可以使用Windows 10和Server 2016 TP5来实现,但RTM(预计下周在Ignite)应该更加稳定。
我已经通过Dockerizing旧的 Nerd Dinner showcase应用程序。你最终得到一个3GB的Docker图像,所以你不会得到一个小而高效的图像的所有好处 - 但是你可以在一个容器里运行你的应用程序,这就是打破巨石的一个出发点。
对于引用,这是编译ASP.NET应用程序的Dockerfile如下所示:
FROM microsoft / iis
RUN [powershell.exe,Install-WindowsFeature NET-Framework-45-ASPNET]
RUN [powershell.exe,安装-WindowsFeature Web-Asp-Net45]
添加网络应用程序/ c:\\web-app
EXPOSE 8081
运行PowerShell新网站-Name'web-app'-Port 8081 -PhysicalPath'c:\web-app'-ApplicationPool'.NET v4.5'
ENTRYPOINT powershell
All the demo I saw lately are oriented Asp.net core (I am not sure how it's stable and functional, as it didn't contain all asp.net features), as Windows server 2016 support containers (and docker), should we be able to deploy an asp.net mvc 4.0 app ?
Yes.
You can use microsoft/windowsservercore
or microsoft/iis
as a base image, install full ASP.NET and run your 'legacy' .NET apps in containers on Windows. You can do it now with Windows 10 and Server 2016 TP5, but the RTM (expected next week at Ignite) should be more stable.
I've shown this by Dockerizing the old Nerd Dinner showcase app. You end up with a Docker image that's 3GB so you won't get all the benefits of having a small, efficient image - but you can run your app in a container, and that's a starting point for breaking down monoliths.
For reference, this is what the Dockerfile for a compiled ASP.NET app looks like:
FROM microsoft/iis
RUN ["powershell.exe", "Install-WindowsFeature NET-Framework-45-ASPNET"]
RUN ["powershell.exe", "Install-WindowsFeature Web-Asp-Net45"]
ADD web-app/ c:\\web-app
EXPOSE 8081
RUN powershell New-Website -Name 'web-app' -Port 8081 -PhysicalPath 'c:\web-app' -ApplicationPool '.NET v4.5'
ENTRYPOINT powershell
这篇关于我们可以在windows容器上部署一个asp.net mvc 4应用程序到docker吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!