Go started: Prep Windows for containers

Applies to: Windows Server 2022, Windows Server 2022, Windows Server 2022

This tutorial describes how to:

  • Fix up Windows ten/11 or Windows Server for containers
  • Install Docker
  • Run your beginning container image
  • Containerize a simple .Net core application

Prerequisites

Windows Server

To run containers on Windows Server, yous need a physical server or virtual machine running Windows Server 2022, Windows Server (Semi-Almanac Channel), Windows Server 2022, or Windows Server 2022.

For testing, you can download a copy of Windows Server 2022 Evaluation or a Windows Server Insider Preview.

Windows 10 and 11

To run containers on Windows 10 or 11, y'all need the following:

  • One physical computer system running Windows x or 11 Professional person or Enterprise with Anniversary Update (version 1607) or after.
  • Hyper-V should be enabled.

Annotation

Starting with the Windows 10 October Update 2022, Microsoft no longer disallows users from running a Windows container in process-isolation way on Windows 10 Enterprise or Professional for evolution ot examination purposes. See the FAQ to acquire more than.

Windows Server Containers use Hyper-V isolation by default on Windows ten and xi to provide developers with the aforementioned kernel version and configuration that will be used in production. To learn more than about Hyper-V isolation, run across Isolation Modes.

Install Docker

Notation

At the end of September 2022, Microsoft appear updates to the Windows Container Runtime support to notify customers that we'll no longer produce builds of Docker EE for the DockerMsftProvider API. Customers who want to install a container runtime on Windows server are encouraged to transition to either containerd, Moby, or the Mirantis Container Runtime. By September 2022, these installation documents will be updated to reflect the Microsoft recommended installation process.

The commencement step is to install Docker, which is required for working with Windows containers. Docker provides a standard runtime environment for containers with a common API and command-line interface (CLI).

For more than configuration details, see Docker Engine on Windows.

  • Windows Server
  • Windows Admin Heart
  • Windows 10 and eleven

To install Docker on Windows Server, you can use a OneGet provider PowerShell module published by Microsoft called the DockerMicrosoftProvider. This provider enables the containers feature in Windows and installs the Docker engine and client. Here's how:

  1. Open an elevated PowerShell session and install the Docker-Microsoft PackageManagement Provider from the PowerShell Gallery.

                          Install-Module -Name DockerMsftProvider -Repository PSGallery -Forcefulness                                          

    If yous're prompted to install the NuGet provider, type Y to install it also.

    If you get an mistake opening the PowerShell gallery, y'all may demand to gear up the TLS version used past the PowerShell client to TLS one.2. To exercise this, run the post-obit control:

                          # Set the TLS version used by the PowerShell client to TLS 1.2. [Organisation.Net.ServicePointManager]::SecurityProtocol = [System.Internet.SecurityProtocolType]::Tls12;                                          
  2. Utilise the PackageManagement PowerShell module to install the latest version of Docker.

                          Install-Package -Name docker -ProviderName DockerMsftProvider                                          

    When PowerShell asks y'all whether to trust the package source 'DockerDefault', blazon A to go on the installation.

  3. After the installation completes, restart the computer.

                          Restart-Computer -Force                                          

If you desire to update Docker later:

  1. Check the installed version using the following command:
                          Get-Package -Name Docker -ProviderName DockerMsftProvider                                          
  2. Find the current version using the following command:
                          Find-Packet -Proper name Docker -ProviderName DockerMsftProvider                                          
  3. When you lot're ready to upgrade, run the following command:
                          Install-Package -Proper name Docker -ProviderName DockerMsftProvider -Update -Force                                          
  4. Finally, run the post-obit command to start Docker:
                          Showtime-Service Docker                                          

Next steps

Now that your environment has been configured correctly, follow the link to learn how to run a container.