How to run docker on Windows Server 2022 Preview?

New Contributor

Hello,

 

I installed Windows Server 2022 Preview Build 20298, and it does not seem to include the docker command. I would like to run "docker build" and "docker run" from PowerShell, but I get the error: "The term 'docker is not recognized...". 

 

Does anyone know how to install the docker command on Windows Server 2022 Preview?

 

Thanks,

 

Tony

7 Replies
Tony - thanks for the interest!

A few steps here:
1) Set up your environment on that build, following the instructions here:
https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tab...

2) Given it's an Insider build, you may need this step as well:
https://hub.docker.com/_/microsoft-windows-servercore-insider

3) Then you can run a command like this to get your Windows Server 2022 Preview container images:
docker pull mcr.microsoft.com/windows/servercore/insider:10.0.20298.1

As a reference, these are Docker Hub Windows Server Base OS container image Insider release pages:
https://hub.docker.com/_/microsoft-windows-servercore-insider
https://hub.docker.com/_/microsoft-windows-nanoserver-insider

I am curious what your use cases will be. What features/technologies are you planning to try out?

Weijuan

@Weijuan Shi Davis Thanks for the response.

 

I tried following the instructions here:

https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tab...

 

However, I get an error on the first step (Install-Module -Name DockerMsftProvider -Repository PSGallery -Force):

 

PS C:\Users\Administrator> Install-Module -Name DockerMsftProvider -Repository PSGallery -Force

Get-PSGalleryApiAvailability : PowerShell Gallery is currently unavailable.  Please try again later.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1748 char:9
+         Get-PSGalleryApiAvailability -Repository $Repository
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-PSGalleryApiAvailability], InvalidOperationException
    + FullyQualifiedErrorId : PowerShellGalleryUnavailable,Get-PSGalleryApiAvailability
 
 
NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
 provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
 running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?

[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

 

 

BTW, the next step suggested here, installing "NuGet" fails as well, even though the connectivity to this system is fine:

 

[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider
'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package
has the tags.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7468 char:21
+ ...     $null = PackageManagement\Install-PackageProvider -Name $script:N ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-Pac
   kageProvider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackagePro
   vider
 
PackageManagement\Import-PackageProvider : No match was found for the specified search criteria and provider name
'NuGet'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7474 char:21
+ ...     $null = PackageManagement\Import-PackageProvider -Name $script:Nu ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (NuGet:String) [Import-PackageProvider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProv
   ider
 
WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Get-PackageProvider : Unable to find package provider 'NuGet'. It may not be imported yet. Try
'Get-PackageProvider -ListAvailable'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7478 char:30
+ ... tProvider = PackageManagement\Get-PackageProvider -Name $script:NuGet ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...PackageProvider:GetPackageProvider) [Get-PackageProvi
   der], Exception
    + FullyQualifiedErrorId : UnknownProviderFromActivatedList,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPacka
   geProvider
 
Install-Module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201'
or newer version of NuGet provider is installed.
At line:1 char:1
+ Install-Module PowerShellGet -RequiredVersion 2.2.4 -SkipPublisherChe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Install-Module], InvalidOperationException
    + FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Install-Module
 

PS C:\Users\Administrator

 

 

Any ideas what might be wrong?

 

Thanks,

 

Tony

 

 

Tony - I couldn't tell why this failed for you. Can you try spinning out another VM? I didn't have any trouble running the installation scripts either using a VM on Azure directly or downloading the VHDX file and spinning up a local VM.
Tony - I tried again today and was able to run it successfully.

I identified the problem. It turns out that our corporate Zscaler security was intercepting certificates, blocking Install-Module from connecting with PSGallery. I reconfigured the VM to use a bridged network instead of a NAT (which Zscaler controls), and I was able to install the docker packages. Everything is working correctly now. Thanks for your help!

Regards,

Tony

Glad you figured it out!