Docker Containers & ASP.NET – from Development to Deployment

intro_images

In this article i will tell about what is Docker. Why Docker is so defective technology for the developers and sys admins. Also, i will build an ASP.NET web application and publish in to the Docker Hub.

What is Docker? “OS level virtualization”

Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction of operating system–level virtualization on Linux. [Source: en.wikipedia.org] Soon Windows Docker container is coming in to the production. Micosoft and Docker is working together and bringing container applications across the platforms both in Windows and Linux. Check here.

Docker, a software container contains the following items.

  • Filesystem,
  • Code or executables,
  • Runtime,
  • System tools,
  • System libraries,
  • And anything you want to install on a server.

Problem with the old system,

  • Slow deployment 
  • Huge cost 
  • Wasted resource 
  • Difficult to scale 
  • Difficult to migrate 
  • Vendor lock in

Old (existing) systems “VM”

  • One physical server contains multiple VM
  • Each VM contains individual applications. 
  • Benefits, come
  • Easy to deploy in cloud
  • Scale up. Pay as you go. 

 

New systems “Docker”

  • Light weight docker container
  • Shares Host OS Kernel 
  • Scalable 
  • Economy
  • Proper use of resources
  • Build once and run in many platform.

 

Why docker is so pupular?

  • Lightweight: Images are constructed from layered filesystems.
  • Open: Open standards allowing containers to run on all major Linux distributions and Microsoft operating systems.
  • Secure: Containers isolate applications from each other.
  • Fast deployment: Faster deployment cycle. Developers are taking care of the server too. 
  • Portability: Build once and ship in many environment. 
  • Economy: Run more apps on one hosts.

Components of Docker

  • Docker daemon or enginee  
  • Docker image 
  • Docker container 
  • Dockerfile 
  • Docker registry

 

Orchestration tools

  • Docker Client
  • Docker Server
  • Docker compose
  • Docker swarm

 Build ASP.NET Application – “DNX”

DNX Project are created with a project.json file. .NET execution environment, the DNX, is not just a runtime environment, but also an SDK. The DNX gives us the ability to cross compile a project across different renditions of a Common Language Runtime. 

Build ASP.NET Application – Steps

 

Step1: Create your ASP.NET project in Visual Studio 2015

 

Step2: Add a “Dockerfile” with proper steps in the project directory 

 

Step3: Build the Dockerfile -> Container is created!

 

Step4: Run the container 

 Step5: Push the container to Docker hub for the world 

Leave a Comment