How to set up ASP.net in Docker

Last updated on May 27 2022
Raigiri Patil

Table of Contents

How to set up ASP.net in Docker

Docker – Setting ASP.Net

ASP.Net is the standard web development framework that is provided by Microsoft for developing server-side applications. Since ASP.Net has been around for quite a long time for development, Docker has ensured that it has support for ASP.Net.

In this blog, we will see the various steps for getting the Docker container for ASP.Net up and running.

Prerequisites

The subsequent steps need to be admisnistere first for running ASP.Net.

Step 1 − Since this can only run on Windows systems, you first need to ensure that you have either Windows 10 or Window Server 2016.

Step 2 − Next, ensure that Hyper-V is and Containers are installed on the Windows system. To install Hyper–V and Containers, you can go to Turn Windows Features ON or OFF. Then ensure the Hyper-V option and Containers is checked and click the OK button.

Page 1 Image 1 55
winfeatures

The system might require a restart after this operation.

Step 3 − Next, you need to use the subsequent Powershell command to install the 1.13.0rc4 version of Docker. The subsequent command will download this and store it within the temp location.

Invoke-WebRequest “https://test.docker.com/builds/Windows/x86_64/docker-1.13.0-   rc4.zip” -OutFile “$env:TEMP\docker-1.13.0-rc4.zip” –UseBasicParsing

Page 2 Image 2 49
cmddownload

Step 4 − Next, you need to expand the archive using the subsequent powershell command.

Expand-Archive -Path “$env:TEMP\docker-1.13.0-rc4.zip” -DestinationPath $env:ProgramFiles

Page 2 Image 3 24
pscmd

Step 5 − Next, you need to add the Docker Files to the environment variable using the subsequent powershell command.

$env:path += “;$env:ProgramFiles\Docker”

Step 6 − Next, you need to register the Docker Daemon Service using the subsequent powershell command.

dockerd –register-service

Step 7 − Finally, you can start the docker daemon using the subsequent command.

Start-Service Docker

Use the docker version command in powershell to verify that the docker daemon is working

Page 3 Image 4 27
startservice

Installing the ASP.Net Container

Let’s see how to install the ASP.Net container.

Step 1 − The first step is to pull the image from Docker Hub. When you log into Docker Hub, you’ll be able to search and see the image for Microsoft/aspnet as shown below. Just type in asp within the search box and click on the Microsoft/aspnet link which comes up within the search results.

Page 3 Image 5 17
container

Step 2 − You’ll see that the Docker pull command for ASP.Net within the details of the repository in Docker Hub.

Page 4 Image 6 16
pull

Step 3 − Go to Docker Host and run the Docker pull command for the microsoft/aspnet image. Note that the image is pretty large, somewhere close to 4.2 GB.

Page 4 Image 7 13
imagelarge

Step 4 − Now go to the subsequent location https://github.com/Microsoft/aspnet-docker and download the entire Git repository.

Step 5 − Create a folder called App in your C drive. Then copy the contents from the 4.6.2/sample folder to your C drive. Go the Docker File within the sample directory and issue the subsequent command −

docker build –t aspnet-site-new –build-arg site_root=/

The subsequent points need to be noted about the above command −

  • It builds a new image called aspnet-site-new from the Docker File.
  • The root path is set to the localpath folder.
Page 5 Image 8 12
aspnet sitenew

Step 6 − Now it’s time to run the container. It can be done using the subsequent command −

docker run –d –p 8000:80 –name my-running-site-new aspnet-site-new

Page 5 Image 9 6
containerrun

Step 7 − You’ll now have IIS running within the Docker container. To find the IP Address of the Docker container, you can issue the Docker inspect command as shown below.

Page 5 Image 10 1
ip address

So, this brings us to the end of blog. This Tecklearn ‘How to set up ASP.net in Docker’ blog helps you with commonly asked questions if you are looking out for a job in DevOps. If you wish to learn Docker and build a career in DevOps domain, then check out our interactive, Containerization using Docker Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/containerization-using-docker/

Containerization using Docker Training

About the Course

Tecklearn has specially designed this Containerization using Docker Training Course to advance your skills for a successful career in this domain. his Docker training online course will help you learn Docker containerization, running Docker containers, Docker image creation, Dockerfile, Docker orchestration, security best practices and more through hands-on projects and case studies. Upon completion of this online training, you will hold a solid understanding and hands-on experience with Docker.

Why Should you take Containerization using Docker Training?

  • Average salary of Docker Expert is $110k – Indeed.com
  • According to Grand View Research, the DevOps market size is estimated to be worth $12.85 billion by 2025. DevOps professionals are highly paid and in-demand throughout industries including retail, eCommerce, finance, and technology.
  • Intuit, PayPal, Splunk, Uber & many other MNC’s worldwide use Docker across industries

What you will Learn in this Course?

Introduction to DevOps

  • What is Software Development
  • Software Development Life Cycle
  • Why DevOps?
  • What is DevOps?
  • DevOps Lifecycle
  • DevOps Tools
  • Benefits of DevOps
  • How DevOps is related to Agile Delivery
  • DevOps Implementation

Containerization using Docker – Part 1

  • Introduction to Docker
  • Understanding Docker Lifecycle
  • Docker Architecture
  • Components of Docker Ecosystem
  • Common Docker Operations
  • Committing changes in a Container
  • Hands On

Containerization using Docker – Part 2

  • Building Custom Docker Images
  • Docker Image
  • Introduction to Docker Swarm
  • Deploying a 2-Node Cluster using Docker Swarm
  • Hands on

 

0 responses on "How to set up ASP.net in Docker"

Leave a Message

Your email address will not be published. Required fields are marked *