Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

Running containers in Windows Server

  • November 12, 2024
  • 13 min read
Cloud and Virtualization Architect. Brandon has over 20 years of experience across multiple sectors. He is responsible for the creative and technical content direction at virtualizationhowto.com
Cloud and Virtualization Architect. Brandon has over 20 years of experience across multiple sectors. He is responsible for the creative and technical content direction at virtualizationhowto.com

Running just plain virtual machines is still needed in some cases for legacy applications. However, for the most part, many are running containerized apps as these are much easier to deploy and definitely increase the speed at which IT operations can deploy new apps. If you are a Windows shop, containers have historically been less user friendly when compared to Linux. However, this process is getting better. What is the latest process for running containers in Windows Server? Let’s take a look.

Why reconsider running containers in Windows Server?

If you haven’t look at running containers inside Windows Server in quite some time, there are several good reasons to take another look at the platform, especially if you are already a “Windows shop” and have many Windows-centric applications you run, such as IIS, and others.

The latest GA Windows Server to date, Windows Server 2022 has many new features and capabilities that make it the best choice so far to run containers and even Kubernetes. Note the following enhancements:

  • Better Kubernetes – Windows is getting better with Kubernetes and with Azure Arc you can run your Azure Kubernetes Service workloads inside Windows Servers running on-premises. It can run a mix of both Linux and Windows nodes so you have flexibility in your hybrid cloud infrastructure.
  • Enhanced security features – The Secured-core features in Windows Server 2022 provide a great layer of protection against many types of attacks and can help to make sure your containers are secured as well. Since containers share the kernel of the container host, your containers benefit from the Secured-core enhancements on your Windows Server host.
  • Better resource utilization – Containers are more efficient than VMs and are often the easiest and most efficient way to run your applications. It also helps with day-to-day management and deployment since container images already have the prerequisites and dependencies included as part of the image. Also, it seems with each new version of Windows Server, Microsoft continues to shrink the size of Windows images that can be pulled from the official repositories.
  • Support for Windows applications – Legacy Windows apps are great candidates for deploying in containers as it makes isolating them and packaging/deploying much easier.
  • Strong integration with Microsoft Azure – We have seen stronger and stronger integration with Microsoft Azure in each new Windows Server release. This is going to continue to be the case with the upcoming release of Windows Server 2025 and beyond. Organizations will have the opportunity to run workloads and scale these from on-premises to cloud and back with the Azure Arc solutions for modern applications.

How do you deploy containers in Windows Server?

We will be using a Windows Server 2022 host to show how to deploy containers. As a prerequisite, you will need a freshly installed instance of Windows Server 2022, preferably running in a virtual machine so we can “rinse and repeat” if needed.

Once you have a Windows Server 2022 machine, there are 3 different container runtimes that you can install on your Windows Server:

  • Docker CE – the standard runtime environment for containers with a common API and CLI (Moby Project)
  • Mirantis (Docker EE) – Provides all the features of Docker CE plus extra features built specifically for enterprise deployments.
  • Containerd – a container runtime that is simple and robust at the same time. It has a daemon for both Linux and Windows and is the de-facto runtime now with Kubernetes.

Microsoft has provided PowerShell scripts to enable the OS features needed (Containers feature) and download either Docker CE, Mirantis (Docker EE), or Containerd.

Using Microsoft’s PowerShell script for Docker CE

In the walkthrough, I will show you how to use the first option, Docker CE script to install Docker on your Windows Server. It actually installs the prerequisite of the containers feature for you and reboots the server.

The script:

Below, I am pasting in the PowerShell one-liner and then running the install-docker-ce.ps1 script.

Pasting in and running the Docker CE installation script for Windows Server

Pasting in and running the Docker CE installation script for Windows Server

 

The script begins to run. It will install the containers feature in Windows Server and then automatically reboot your server.

Running the Docker CE installation script that enables containers

Running the Docker CE installation script that enables containers

 

Once you log back in, you will see the script check to make sure the containers feature is installed and it will finish out the installation.

The containers installation script in Windows Server finishes

The containers installation script in Windows Server finishes

 

We can run a quick docker ps command to make sure we can issue Docker commands:

Running a docker ps command

Running a docker ps command

Hyper-V isolation

If you want to use Hyper-V isolation with your containers which is a great feature to take advantage of, you can do that by installing the Hyper-V Role and the management tools for the role service:

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools

Once you install Hyper-V you will need to reboot.

Windows Server container management with Windows Admin Center

While working with containers from the command line is very effective for quick tasks and automation, if you want a true interface to work with your containers in Windows Server, you can install Windows Admin Center. This is the next-generation server management tool from Microsoft that will allow you to have a quick web frontend for many management features in Windows, including managing your containers.

Windows Admin Center is a quick download from Microsoft that is free to use with your Windows license. The installation is a “next, next, finish” process.

Finishing the installation of Windows Admin Center

Finishing the installation of Windows Admin Center

 

You can then add the Containers extension in Windows Admin Center.

Installing the containers extension in Windows Admin Center

Installing the containers extension in Windows Admin Center

 

Once the container extension is installed, you will see this menu item listed under the Tools section.

Viewing the containers extension in Windows Admin Center

Viewing the containers extension in Windows Admin Center

 

You can see under the Container host section in the containers extension, you can see the following:

  • Overview
  • Containers
  • Images
  • Networks
  • Volumes

You can easily pull new images and spin up containers right from the Windows Admin Center console.

Pulling a Windows Server Core container image in Windows Admin Center

Pulling a Windows Server Core container image in Windows Admin Center

Can you run Linux containers?

As we know, containers share the container host kernel. So, you will have to run Linux containers in a container host virtual machine. However, with the availability of running Linux virtual machines in Hyper-V, a Windows Server host with Hyper-V installed along with the containers feature is a great all-in-one solution to run a wide range of containerized apps, both Windows and Linux based.

Wrapping up

Windows Server is becoming a much better container platform for running business-critical containerized apps. Each new version of Windows Server has enhanced features for running Docker containers and Kubernetes applications.

Windows Server 2022 has better security than ever before with Secured-core server and the upcoming release of Windows Server 2025 will continue to build on this secure by default foundation. With the strong Microsoft Azure integration with Windows Server solutions, organizations can manage their containers in the cloud and have the data plane exist on-premises if they want with the Azure Kubernetes Service.

Windows Admin Center ties everything together with a modern management tool that enables admins to have a web-based tool that exposes all the new functionality in a seamless way. Hopefully, looking at how easy it is to get up and running with containers on Windows Server will prompt readers to investigate this solution once again as it has certainly come a long way.

Found Brandon’s article helpful? Looking for a reliable, high-performance, and cost-effective shared storage solution for your production cluster?
Dmytro Malynka
Dmytro Malynka StarWind Virtual SAN Product Manager
We’ve got you covered! StarWind Virtual SAN (VSAN) is specifically designed to provide highly-available shared storage for Hyper-V, vSphere, and KVM clusters. With StarWind VSAN, simplicity is key: utilize the local disks of your hypervisor hosts and create shared HA storage for your VMs. Interested in learning more? Book a short StarWind VSAN demo now and see it in action!