首页 > 解决方案 > Docker 安装在 Windows Server 2019 上失败

问题描述

我正在尝试在 Windows Server 2019 上安装 Docker(不是Docker Desktop——它在 Windows Server 上不起作用;我们已经尝试过)。我正在关注本指南:https ://blog.sixeyed.com/getting-started-with-docker-on-windows-server-2019/ 。我在升级的 PowerShell 窗口中运行以下命令(并使用本地管理员帐户登录)

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force

那部分成功了,所以我进入下一步:

Install-Package -Name docker -ProviderName DockerMsftProvider -verbose

我收到以下错误:

> VERBOSE: Using the provider 'DockerMsftProvider' for searching
> packages. WARNING: Cannot find path
> 'C:\Users\ADMINI~1\AppData\Local\Temp\4\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:1 char:1
> + Install-Package -Name docker -ProviderName DockerMsftProvider -verbos ...
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],
> Ex    ception
>     + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

我已经阅读了几个有关此错误的论坛,因此我也尝试过:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet
Install-Module DockerMsftProvider -Force
Install-Package Docker -ProviderName DockerMsftProvider -Force

...但我收到以下错误:

WARNING: Cannot find path
'C:\Users\ADMINI~1\AppData\Local\Temp\4\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:1 char:1
+ Install-Package Docker -ProviderName DockerMsftProvider -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exc
   eption
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

我读过的关于这个问题的大多数论坛都与代理问题有关,但是虚拟机不在代理后面——只是一个思科防火墙——并且 Windows Defender 防火墙被完全禁用。

我确认已经安装了 Container 功能以及 Hyper-V。由于这台机器是虚拟机,所以我还在 VMware 中启用了“向来宾操作系统公开硬件辅助虚拟化”和“启用虚拟化 CPU 性能计数器”。

标签: windowsdockerpowershellserver

解决方案


问题显然与 Windows 注册表中的密码有关。运行 Get-PackageSource 后,IsTrusted for DockerDefault 为 False。因此,我们运行 IIS Crypto CLI(在 CMD 中:.\iiscryptocli.exe /template default /reboot)将 Windows 加密注册表项重置为默认值,重新启动后,Docker 安装成功。所以我猜 PowerShell Install-package cmdlet 无法从https://go.microsoft.com/fwlink/?LinkID=825636&clcid=0x409获取帮助安装 Docker 所需的 JSON 文件,因为加密协商问题。


推荐阅读