Installing Docker on Windows Server 2022
Docker was initially created as a Linux-based containerization solution. Docker has since expanded to include Microsoft operating systems.
Since Windows Server 2019, there has been a greater effort to address inconsistencies between Windows and Linux Docker hosts. Windows Server 2022 takes this process even further.
Docker installation requirements on Windows Server 2022
Docker containers on Windows come in two flavours:
- Process isolation: Containers and OS share the host kernel.
- Hyper-V: This offers secure kernel options and greater compatibility.
To enable this feature requires Hyper-V to be enabled on the host.
Hyper-V is optional during installation but is necessary to run containers in isolation mode.
OS builds are a very important factor when setting up containerization. A guest OS needs to be an equal or lower build to the host operating system.
Docker installation for Server 2022
Before installing Docker, Windows Server 2022 requires the Containers feature to be enabled.
To do this:
- Open the Windows Server Manager
- Select Manage
- Select Add Roles and Features
Click Next on the Before You Begin page.
Select the name of the server where the feature will be installed and click Next
No selections are to be made on the Server Roles page; simply click Next.
On the Features page, tick the box next to Containers and click Next.
Once the feature has been installed, click Close.
Note: This will trigger a system reboot.
After the system has rebooted, run PowerShell as an administrator.
Run the below command:
Install-Module -Name DockerMsftProvider -Repository PSGallery –Force
When prompted for the NuGet installation, type Y and hit Enter.
Next run the below command to install the latest Docker version:
Install-Package -Name docker -ProviderName DockerMsftProvider
When prompted for the NuGet installation, type A to install all and hit Enter.
Once installation is completed, the installed Docker version will show.
Another way to check the Docker build is to run the below PowerShell command:
Running your first Docker container on Server 2022
To get started with your first container on Windows Server 2022, do the below:
Ensure the Docker service is running via PowerShell
Download a sample container
Docker pull mcr.microsoft.com/dotnet/samples:dotnetapp
The previous command will download the image.
Test the container with:
Docker run –rm mcr.microsoft.com/dotnet/samples
Seeing the below output will confirm that the container successfully ran.
We hope that this guide simplifies your journey into containerization.
Leave a ReplyWant to join the discussion?
Feel free to contribute!