我尝试使用 PowerShell 在 Windows Server 2016 上安装 Docker,但遇到问题。这是我正在使用的命令:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
set-executionpolicy unrestricted
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name DockerMsftProvider -Force
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
这是错误
WARNING: Cannot find path 'C:\Users\AZUREL~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json' because it does not exist.
WARNING: Cannot bind argument to parameter 'downloadURL' because it is an empty string.
WARNING: The property 'AbsoluteUri' cannot be found on this object. Verify that the property exists.
WARNING: The property 'RequestMessage' cannot be found on this object. Verify that the property exists.
Install-Package : No match was found for the specified search criteria and package name 'docker'. Try Get-PackageSource to see all available registered package
sources.
At line:9 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
DockerMsftProvider 已关闭 github。
您可以使用microsoft教程中的install-docker-ce.ps1,并在PowerShell64位
中运行它.\安装-docker-ce.ps1
但是该脚本将安装最新版本(V24),它在 Windows Server 2016 上不起作用。
所以你必须从binary手动安装,最新的工作版本是20.10.9
C:> 展开存档 /path/to/.zip -DestinationPath $Env:ProgramFiles
C:> &$Env:ProgramFiles\Docker\dockerd --register-service
PS。大多数 docker 镜像无法在 Windows Server 2016 下运行,最好迁移到 Windows Server 2019