Skip to main content
Welcome to this module of our Azure Kubernetes Service (AKS) course. In this lesson, you’ll learn how to:
  • Scaffold and run a simple ASP.NET Core Razor Pages application
  • Containerize the app using Docker Desktop
  • Optionally pull a pre-built image from Docker Hub
The Docker image you build here will be deployed to Azure in a later lesson.

Prerequisites

Make sure you have the following installed:
Ensure Docker Desktop is running before you build or pull any images.

1. Creating the ASP.NET Core Application

We’ll scaffold a basic Razor Pages app and review the IndexModel class. Create a new project and replace the contents of Pages/Index.cshtml.cs with:
This minimal page model logs requests and serves the Razor Page on HTTP GET.

2. Containerizing with Docker

At the root of your ASP.NET project, add a Dockerfile similar to:
Build the Docker image:
A successful build will output stages like:
After completion, you’ll have an image tagged yourrepo/kodekloudapp:latest.

3. Using a Pre-built Image (Optional)

If you’d rather skip local builds, pull the image directly from Docker Hub:
You can browse Docker Hub and search for yourrepo/kodekloudapp to verify the image and get the exact pull command.

References

Watch Video