In this blog post, I’ll show you how I run an ASP.NET Core 2.0 Web Application on Windows Server Container with Docker.
About .NET Core
Version 2.0 of ASP.NET CORE Is a cross-platform open source framework that can be run on Windows, Linux or Mac.
In my case, I will use the dotnet Container Image which Is using the Windows Nano Server 2016 Container Image loaded with ASP.NET Core 2.0 version.
To get this done, I’ll use the Microsoft ASP.NET Core 2.0 Container Image that runs on Windows Nano Server 2016 Operating Systems.
For more details about the Image visit the URL below.
To download the Image use the command below
Docker pull microsoft/dontnet
Now, that I have the Image I’ll run the command below that will create a Container with port 8000 open on the host and mapped to port 80 on the container.
I’m also using the –rm switch to delete the container on exit.
docker run -p 8000:80 -e "ASPNETCORE_URLS=http://+:80" -it --rm microsoft/dotnet
Create Web a Razor web Application
Now, that my Container Is up and running. I’ll create a web app and run it using the commands below
mkdir myapp cd myapp dotnet new razor dotnet run
Once the application Is running I can run it using Container Host IP address and use port 8000