Containers

IIS to Docker Image with Windows Admin Center

IIS to Docker Image with Windows Admin Center

Many organizations heavily utilizing traditional IIS websites running on top of full virtual machines would like to start migrating to a more modern approach using containers running on top of Docker. By running Windows containers, we can successfully run IIS sites on top of Docker fairly easily. A new feature with Windows Server 2022 container hosts in conjunction with the latest version of Windows Admin Center allows creating a Docker image from an existing IIS web site very easily. There have been a few tools out in the community, such as Image2Docker, to create IIS Docker images from IIS. However, Microsoft has now added this functionality natively in Windows Admin Center, which is awesome. Let’s take a look.

What is Windows Admin Center?

Windows Admin Center is Microsoft’s next-generation hybrid cloud management tool, allowing management of on-premises resources like Windows Servers, clusters, and cloud resources in Microsoft Azure.

Windows Admin Center is a tool you should be getting familiar with if you manage and administer Windows Server, Azure, Clusters, and other hybrid resources between on-premises and Azure. Microsoft is also making some functionality only available using Windows Admin Center, such as Azure network adapter.

Windows Admin Center is also a free tool and can be used if you have a valid Windows Server license. So, there is no cost associated with using it. Microsoft keeps adding great features and functionality to the solution, making it even more worthwhile to use. New features are added each time I have downloaded and updated plugins, etc.

Windows Admin Center overview dashboard
Windows Admin Center overview dashboard

Why run IIS in Docker?

Running IIS websites in Docker makes a lot of sense. IIS sites are usually small footprint services that provide a web tier layer for modern applications. Web services and applications usually make great candidates for containerization due to the small footprint of the service itself.

Also, creating your own Docker container image for IIS is pretty straightforward and doesn’t require much in the way of complexity to spin up a new IIS container.

IIS to Docker Image using Windows Admin Center

I would like to shed light on a new feature of Windows Server 2022 container hosts in conjunction with Windows Admin Center, where you can easily “P2V” your existing IIS website to a Docker container image. This is a great feature since it creates an image of your existing IIS site so that it captures the configuration, etc.

Let’s see how this works. Launch Windows Admin Center and connect to your Windows Server container host. In my case, I have a Windows Server 2022 host configured with Docker. If you would like to know how I configured by Windows Server 2022 server with Docker, look at my post here:

You can also check out my YouTube video covering Server 2022 and Docker:

Navigating to the containers node in Windows Admin Center
Navigating to the containers node in Windows Admin Center

If you navigate to the Containers > Images > Create New option, it will launch the Create Image functionality for creating a custom Docker container from a running IIS site.

Creating a new Container image in Windows Admin Center
Creating a new Container image in Windows Admin Center

The Create Image blade launches. The following was selected by default in my case:

  • Windows IIS Web Application
  • Static Web Application Folder

Then I browsed out to the c:\inetpub to select the default IIS website. I populated the:

  • Image name
  • Image tag

The only other change I needed to make was alter the Dockerfile in the preview pane. It by default was pulling the ltsc2019 image. When I tried to run it using the 2019 image, it gave an error that the operating system did not match the image requested.

So I altered the FROM directive to the following:

FROM mcr.microsoft.com/windows/servercore/iis

Sources:

As a note, you can select other sources as well. These include:

  • Visual Studio Solution(ASP.NET)
  • Web Deploy (Exported ZIP file)
Creating a new IIS to Docker container image based on an existing IIS website
Creating a new IIS to Docker container image based on an existing IIS website

After just a few seconds, the Docker image is created from the existing website.

New IIS Docker container image created successfully with Windows Admin Center
New IIS Docker container image created successfully with Windows Admin Center

You can take a look at your local Docker container images using the command:

docker image ls

It will show the new container image created using the Windows Admin Center build image process. This is a

New container image is listed on the Windows Server container host
New container image is listed on the Windows Server container host

Windows Admin Center FAQs

Is Windows Admin Center free? Yes it is a free download from Microsoft. It is included with your Windows licensing.

Can you manage both on-premises and Azure resources with Windows Admin Center? Yes, you can. You can manage traditional resources such as Windows Server, Windows Server Failover Clusters, and other traditional resources.

Can you manage contained with Windows Admin Center? Yes. Windows Admin Center provides a container extension that allows managing your containers, images, and controlling container actions, right from Windows Admin Center.

Wrapping Up

The new ability to create Docker images from the Windows Admin Center GUI is awesome. No longer is artisanal skill required to create Docker containers. You can do this in a wizardized approach that will likely work for most. As shown, I needed to change the FROM directive in the Dockerfile with the latest ServerCore image. However, I expect this functionality will likely get better and better as it matures.

Take a look at what’s new with Windows Server 2022 Container hosts here:

Read my other Windows Server 2022 posts here:

Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.