Can I Run a dotnet app which is hosted on IIS in a docker container? Can I Run a dotnet app which is hosted on IIS in a docker container? docker docker

Can I Run a dotnet app which is hosted on IIS in a docker container?


You need to change a little your Dockerfile, try this:

#Making a dotnet containerFROM microsoft/iisSHELL ["powershell"]RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \      Install-WindowsFeature Web-Asp-Net45RUN Remove-WebSite -Name 'Default Web Site'  RUN New-Website -Name 'app' -Port 80 \      -PhysicalPath 'c:\app' -ApplicationPool '.NET v4.5'#copy dll files and other dependenciesCOPY app app#dotnet run should run the appCMD ["ping", "-t", "localhost"]  

Test it

docker build -t app .  docker run --name app -d -p 80:80 appdocker inspect --format="{{.NetworkSettings.Networks.nat.IPAddress}}" app

It will give you an ip just test it in your browser.

More information: Run IIS + ASP.NET on Windows 10 with Docker