Windows Server is extremely scalable and provides a robust platform for hosting and managing various types of server-based applications and services.
It comes with features such as Active Directory for user and resource management, file and print services, web server capabilities, virtualization support through Hyper-V, and extensive security and networking functionalities.
In this tutorial, we will learn how to run the Windows Server as Docker container using the official Docker image.
Requirements:
To run the Windows Server on Docker, you need the following:
- A Windows host with the Windows container feature enabled. This feature is only available on Windows Server 2016 (core and Desktop), Windows 10 Professional, and Windows Enterprise.
- Installed and enabled Hyper-v role on the host
- Installed Docker Engine version 23 and above recommended
- Windows Server Container hosts must have the Windows installed to “c:”
Enable the Windows Container Feature
The first step is to enable the Windows Container feature. We can do this by opening the star menu and searching for “turn windows features on and off”.
In the resulting window, locate the container feature and select to enable it as follows:
Once enabled, save the changes and proceed. This may require you to restart your Windows machine to apply the changes.
In the next step, ensure that you have the Docker installed on your machine.
Pull the Windows Server
The next step is to download the Windows Server imaging from the Docker Hub.
Windows requires the host OS version to match the container OS version. If you want to run a container based on a newer Windows build, make sure that you have an equivalent host build.
Therefore, the Windows Server does not have a latest tag which allows you to specify which version of the image you wish to download.
The supported tags are as follows:
In our case, we use the ltsc2022 version. Run the command as follows:
Once you downloaded the image, you can run the container with the downloaded version as follows:
This runs the container with the specified configurations with a default entry point of “cmd.exe”.
Conclusion
In this tutorial, we covered how to quickly download and run the Windows Server as a Docker container.