简体   繁体   中英

Can we deploy an asp.net mvc 4 app to docker with windows container?

我最近看到的所有演示都是面向 Asp.net 核心的(我不确定它的稳定性和功能如何,因为它不包含所有 asp.net 功能),因为 Windows Server 2016 支持容器(和 docker),我们应该能够部署一个 asp.net mvc 4.0 应用程序吗?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM