Get started: Prep Windows for containers

Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016

This tutorial describes how to:

  • Fix Windows 10/xi or Windows Server for containers
  • Install Docker
  • Run your first container image
  • Containerize a uncomplicated .Cyberspace cadre application

Prerequisites

Windows Server

To run containers on Windows Server, you lot need a physical server or virtual motorcar running Windows Server 2022, Windows Server (Semi-Annual Aqueduct), Windows Server 2019, or Windows Server 2016.

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

Windows 10 and eleven

To run containers on Windows ten or 11, you demand the following:

  • One concrete estimator system running Windows 10 or 11 Professional or Enterprise with Anniversary Update (version 1607) or later.
  • Hyper-V should be enabled.

Note

Starting with the Windows 10 October Update 2018, Microsoft no longer disallows users from running a Windows container in process-isolation mode on Windows 10 Enterprise or Professional for evolution ot test purposes. See the FAQ to learn more.

Windows Server Containers employ Hyper-V isolation past default on Windows 10 and xi to provide developers with the same kernel version and configuration that will be used in production. To larn more than about Hyper-V isolation, see Isolation Modes.

Install Docker

Note

At the end of September 2021, Microsoft announced updates to the Windows Container Runtime back up 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 volition be updated to reflect the Microsoft recommended installation process.

The outset footstep 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 configuration details, see Docker Engine on Windows.

  • Windows Server
  • Windows Admin Eye
  • Windows 10 and xi

To install Docker on Windows Server, you can utilize 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. Hither's how:

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

                          Install-Module -Proper noun DockerMsftProvider -Repository PSGallery -Force                                          

    If you're prompted to install the NuGet provider, type Y to install it equally well.

    If you go an error opening the PowerShell gallery, y'all may demand to set the TLS version used by the PowerShell customer to TLS 1.two. To do this, run the following command:

                          # Set the TLS version used by the PowerShell customer to TLS i.ii. [Arrangement.Net.ServicePointManager]::SecurityProtocol = [Organisation.Cyberspace.SecurityProtocolType]::Tls12;                                          
  2. Use the PackageManagement PowerShell module to install the latest version of Docker.

                          Install-Bundle -Name docker -ProviderName DockerMsftProvider                                          

    When PowerShell asks you lot whether to trust the package source 'DockerDefault', type A to go on the installation.

  3. After the installation completes, restart the computer.

                          Restart-Reckoner -Forcefulness                                          

If yous desire to update Docker later on:

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

Next steps

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