Hello ASP.NET 5 on Docker

Microsoft announced open source .NET earlier this week, and just released a version of their Docker container for running ASP.NET 5 application. I am glad to see the base ASP.NET image size is just around 473MB. I wanted to run a Hello Mvc Application with the new container. Here is how you can use the base image.

docker pull microsoft/aspnet  
 cd ~ && wget https://github.com/aspnet/Home/archive/master.zip && unzip master.zip && rm master.zip

Next we need a script that restores nuget packages and runs the server. You can get it from gist.github.com

cd ~ && wget https://gist.githubusercontent.com/aminjam/a00cfeb42b01754c3ca0/raw/e5d124de4682d7471d0379ebb21debf411e87c63/asp-net-5-run.sh && chmod +x asp-net-5-run.sh  

Let's look what's inside of the shell script. cat ~/asp-net-5-run.sh

#!/bin/bash
cd /home && kpm restore && k kestrel  

Now that we have the Hello Mvc app and a shell script to kick off the web server, let's run it.

docker run -p 5004:5004 -v ~/Home-master/samples/HelloMvc:/home:ro -v ~/asp-net-5-run.sh:/home/run.sh -dt microsoft/aspnet /home/run.sh  

That's it. If you hit your linux box IP on port 5004, you should see the Hello Mvc running. This is Awesome! Next, I will be building a hipops docker orchestration for ASP.NET 5.

Next: ASP.NET 5 Docker Orchestration for a Todo App

comments powered by Disqus