Docker

Docker Windows Service

Windows Server is a versatile operating system developed by Microsoft that is specifically designed for use in server environments. It is based on the Windows kernel but is oriented towards the functionality of data centers and complex environments.

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:

$ docker pull mcr.microsoft.com/windows/server: ltsc2022

Once you downloaded the image, you can run the container with the downloaded version as follows:

$ docker run mcr.microsoft.com/windows/server:ltsc2022

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.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list