Create and Run a Windows Server Container Image on Windows Server

45 minutes
  • 4 Learning Objectives

About this Hands-on Lab

This lab walks through the process of creating a Windows Server container image and running the image on Windows Server.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install Docker on VM1
  1. Update Nuget to the minimum required version to install Docker.
  2. Install the Docker PowerShell module.
  3. Install the Docker package.
Create a Dockerfile
  1. Create a Dockerfile using Visual Studio Code with the following instructions:

    FROM mcr.microsoft.com/windows/servercore:ltsc2022
    RUN powershell.exe -command Add-WindowsFeature Web-Server
    ADD "https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.10/ServiceMonitor.exe" "C:\ServiceMonitor.exe"
    WORKDIR c:\inetpub\wwwroot
    COPY index.html index.html
    EXPOSE 80
    ENTRYPOINT ["C:\ServiceMonitor.exe", "w3svc"]
  2. Create an index.html file in the working directory and include some HTML content in that file, for example:

    <h1>Hello from Docker!</h1>
Build Your Container Image

Build your container image using your Dockerfile.

Run Your Container Image

Run your container image.

Additional Resources

Scenario

As you walk through the lab, consider the following scenario:

You are a senior DevOps engineer at Barrier Reef Audio, a company that focuses on generating text from speech using a range of high-quality audio equipment and machine learning.

You are responsible for managing the virtualization infrastructure at BRA. You have learned about Docker and containerization and the advantages of containerization. Now, you want to demonstrate to the team, how easy it is to create Windows container images for existing IIS websites and get them up and running on a Windows Server container host.

In this lab, you will:

  1. Install Docker.
  2. Create a Dockerfile.
  3. Build a container image.
  4. Run your container image.

Lab Setup

In this lab, you will be connecting to VMs using remote desktop. You won’t need to access the Azure Portal.

Note: To complete this lab, you will need to use a remote desktop client.

If you get stuck, feel free to check out the lab objectives or the solution video. Good luck!

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?