Get-PSRepository,powershell 警告:尝试在 WindowsServer2016 中安装 Docker 时“无法找到模块存储库”

问题描述

我想安装 Docker,所以我尝试了以下命令,但出现错误

PS C:\Windows\system32> Install-Module -Name DockerMsftProvider PackageManagement\Install-Package:未找到与指定搜索条件和模块名称“DockerMsftProvider”匹配的内容。尝试 Get-PSRepository 以查看所有可用的已注册模块存储库。 在 C:\Program Files\ WindowsPowerShell\ Modules\ PowerShellGet\ 1.0.0.1\ PSModule .psm1:1772 char:21 $null = PackageManagement\Install-Package @PSBoundParameters CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage ) [Install-Package],Exception +fullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

甚至 Install-Module -Name DockerMsftProvider -Repository PSGallery -Force 也给出了同样的错误。

我尝试了以下资源,但仍然相同。我无法注册 PSRepository。只有安装了这个,我才能在 Windows Server 中安装 Docker。我花了几个小时来解决这个问题,但进展仍然为 0%。注册 PSRepository (Register-PSRepository -Default -InstallationPolicy Trusted) 很顺利,没有任何错误,但仍然不可见。

任何可能的帮助来解决这个问题?

https://copdips.com/2018/05/setting-up-powershell-gallery-and-nuget-gallery-for-powershell.html

WARNING: Unable to find module repositories

Unable to find module providers

https://www.powershellgallery.com/packages/PowerShellGet/2.2.1

https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-Server#prerequisites

解决方法

试试运行这个,你仍然得到错误吗?

[System.Net.WebRequest]::DefaultWebProxy = [System.Net.WebRequest]::GetSystemWebProxy()
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
Install-Module -Name DockerMsftProvider -Scope AllUsers

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...