gpt4 book ai didi

windows - 尝试使用 Install-Module 在 Windows Server 2016 中安装 Docker 时出错

转载 作者:行者123 更新时间:2023-12-02 19:08:23 31 4
gpt4 key购买 nike

我正在尝试在 Windows Server 2016 中安装 Docker,但没有成功:

PS C:\Windows\system32> Install-Module -Name "DockerMsftProvider" -Force -Verbose
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2/' and PackageManagementProvider is
'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='DockerMsftProvider'' for
''.
VERBOSE: Total package yield:'1' for the specified package 'DockerMsftProvider'.
VERBOSE: Performing the operation "Install-Module" on target "Version '1.0.0.1' of module 'DockerMsftProvider'".
VERBOSE: The installation scope is specified to be 'AllUsers'.
VERBOSE: The specified module will be installed in 'C:\Program Files\WindowsPowerShell\Modules'.
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'DockerMsftProvider' with version '1.0.0.1' from the repository
'https://www.powershellgallery.com/api/v2/'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='DockerMsftProvider'' for
''.
VERBOSE: InstallPackage' - name='DockerMsftProvider',
version='1.0.0.1',destination='C:\Users\x\AppData\Local\Temp\1514242672'
VERBOSE: DownloadPackage' - name='DockerMsftProvider',
version='1.0.0.1',destination='C:\Users\x\AppData\Local\Temp\1514242672\DockerMsftProvider\DockerMsftProvider.nup
kg', uri='https://www.powershellgallery.com/api/v2/package/DockerMsftProvider/1.0.0.1'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/DockerMsftProvider/1.0.0.1'.
VERBOSE: An error occurred while sending the request.
VERBOSE: Retry downloading 'https://www.powershellgallery.com/api/v2/package/DockerMsftProvider/1.0.0.1' for '2' more
times
VERBOSE: An error occurred while sending the request.
VERBOSE: Retry downloading 'https://www.powershellgallery.com/api/v2/package/DockerMsftProvider/1.0.0.1' for '1' more
times
VERBOSE: An error occurred while sending the request.
VERBOSE: Retry downloading 'https://www.powershellgallery.com/api/v2/package/DockerMsftProvider/1.0.0.1' for '0' more
times
VERBOSE: Downloading package 'DockerMsftProvider' failed, please make sure
'https://www.powershellgallery.com/api/v2/package/DockerMsftProvider/1.0.0.1' is accessable.
WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/DockerMsftProvider/1.0.0.1' is not valid.
PackageManagement\Install-Package : Package 'DockerMsftProvider' failed to download.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.1.3.1\PSModule.psm1:1827 char:21
+ ... $null = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\Users\943397...tProvider.nupkg:String) [Install-Package], Excep
tion
+ FullyQualifiedErrorId : PackageFailedInstallOrDownload,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPac
kage

当 o 尝试通过 IE 访问 URL 时,它看起来很迷人,
我在公司代理和防火墙后面,没有任何网络配置。

编辑:使用这个我解决了错误但得到另一个
netsh winhttp import proxy source=ie
$webclient=New-Object System.Net.WebClient
$creds=Get-Credential
$webclient.Proxy.Credentials=$creds

现在我得到:
PS C:\Windows\system32> Find-Package –providerName DockerMsftProvider
WARNING: Cannot find path 'C:\Users\x\AppData\Local\Temp\DockerMsftProvider\DockerDefault_DockerSearchIndex.json'
because it does not exist.
WARNING: Save-HTTPItem: Bits Transfer failed. Job State: BG_JOB_STATE_ERROR ExitCode = 0

建议?

编辑 2:伙计们,设置环境变量 HTTP_PROXY 和 HTTPS_PROXY 对我有用
https://docs.docker.com/engine/admin/systemd/#httphttps-proxy

最佳答案

我尝试了上述所有解决方案,但在运行此命令之前我无法让它工作

   set-executionpolicy unrestricted
最后,以下步骤对我有用:
[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
Restart-Computer -Forc

关于windows - 尝试使用 Install-Module 在 Windows Server 2016 中安装 Docker 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45638302/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com