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.
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:
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.
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:
As a note, you can select other sources as well. These include:
- Visual Studio Solution(ASP.NET)
- Web Deploy (Exported ZIP file)
After just a few seconds, the Docker image is created from the existing website.
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
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.
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:
- What’s new for Windows containers in Windows Server 2022 | Microsoft Docs
- Windows Server 2022 backup and restore
- Windows Server 2022 Essentials Edition Download and Pricing
- Cloud Storage Windows Server 2022 and Azure File Sync