未找到与提供程序“NuGet”的指定搜索条件匹配的内容

Nah*_*med 5 powershell nuget

当我运行此 Install-PackageProvider -Name NuGet -Force 它通过错误时。错误是

Install-PackageProvider:未找到与提供程序“NuGet”的指定搜索条件匹配的内容。包提供程序需要“PackageManagement”和“Provider”标签。请检查指定的包裹是否有标签。

我尝试这个解决方案但不起作用

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

错误图片

Atu*_*tul 4

即使我尝试使用的服务器已连接到互联网,我也会遇到此错误。这是 Windows 2016 Server,我正在安装 Docker Enterprise Edition。\n我发现此处发布的文档似乎已过时。docker hub上似乎没有关于如何安装EE的文档。我也曾在某处读到过

\n
\n

Enterprise 已于 2019 年 11 月被 Mirantis 收购,\n下载已于 2020 年 12 月左右从 Docker Hub 中删除

\n
\n

然而,我仍然继续执行这些步骤并进行一些更改,并设法在 Windows 2016 服务器上安装和运行 docker EE 服务(不是 Docker Desktop)。简而言之,我在管理模式下使用“Powser Shell ISE”,而不是“Power Shell”,我还更改了命令参数。

\n

以下是详细步骤:

\n
    \n
  1. 在以管理员身份运行模式下打开 Powershell ISE。运行命令:

    \n
     [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n
    Run Code Online (Sandbox Code Playgroud)\n
  2. \n
  3. 现在使用以下命令安装 NuGet 包。

    \n
     Install-PackageProvider -Name NuGet\n
    Run Code Online (Sandbox Code Playgroud)\n
  4. \n
  5. 现在在 PowerShell 中安装 DockerMsftProvider 模块。使用以下命令来执行此操作。

    \n
     Install-Module -Name DockerMsftProvider\n
    Run Code Online (Sandbox Code Playgroud)\n
  6. \n
  7. 然后运行这个:

    \n
     Install-package -name docker -providername DockerMsftProvider -Verbose -Force\n
    Run Code Online (Sandbox Code Playgroud)\n
  8. \n
  9. 然后检查是否需要重启:

    \n
     (Install-WindowsFeature Containers).RestartNeeded\n
    Run Code Online (Sandbox Code Playgroud)\n
  10. \n
  11. 如果 \xe2\x80\x98Yes\xe2\x80\x99 使用以下命令重新启动服务器:

    \n
     Restart-Computer\n
    Run Code Online (Sandbox Code Playgroud)\n
  12. \n
\n

它将在 C:\\Program Files\\docker 中安装 docker 二进制文件

\n

之后,您可能需要在 Windows 服务 (services.msc) 中手动启动 docker 服务,或者您可以start-service docker在 Power Shell 中使用命令。

\n

然后通过运行容器来测试您的 Docker EE 安装hello-world

\n
    docker container run hello-world:nanoserver\n
Run Code Online (Sandbox Code Playgroud)\n

您可能会收到此错误:

\n
\n

清单列表中没有 windows/amd64 10.0.16299 的匹配清单\n在拉取 hello-world 映像时出现错误

\n
\n

这是因为示例容器不支持我们的 server\xe2\x80\x99s AMD 处理器。然后你可以尝试运行这个容器:

\n
    hello-world:nanoserver-sac2016\n
Run Code Online (Sandbox Code Playgroud)\n

这是成功输出的示例:

\n
PS C:\\Users\\Administrator> docker run hello-world:nanoserver-sac2016\ndocker : Unable to find image \'hello-world:nanoserver-sac2016\' locally\nAt line:1 char:1\n+ docker run hello-world:nanoserver-sac2016\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n    + CategoryInfo          : NotSpecified: (Unable to find ...ac2016\' locally:String) [], RemoteException\n    + FullyQualifiedErrorId : NativeCommandError\n \nnanoserver-sac2016: \nPulling from library/hello-world\nbce2fbc256ea: \nPulling fs layer\n6f2071dcd729: \nPulling fs layer\n909cdbafc9e1: \nPulling fs layer\na43e426cc5c9: \nPulling fs layer\na43e426cc5c9: \nWaiting\n909cdbafc9e1: \nVerifying Checksum\n909cdbafc9e1: \nDownload complete\na43e426cc5c9: \nVerifying Checksum\na43e426cc5c9: \nDownload complete\nbce2fbc256ea: \nVerifying Checksum\nbce2fbc256ea: \nDownload complete\n6f2071dcd729: \nVerifying Checksum\n6f2071dcd729: \nDownload complete\nbce2fbc256ea: \nPull complete\n6f2071dcd729: \nPull complete\n909cdbafc9e1: \nPull complete\na43e426cc5c9: \nPull complete\nDigest: sha256:878fd913010d26613319ec7cc83b400cb92113c314da324681d9fecfb5082edc\nStatus: Downloaded newer image for hello-world:nanoserver-sac2016\n\nHello from Docker!\nThis message shows that your installation appears to be working correctly.\n\nTo generate this message, Docker took the following steps:\n 1. The Docker client contacted the Docker daemon.\n 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.\n    (windows-amd64, nanoserver-sac2016)\n 3. The Docker daemon created a new container from that image which runs the\n    executable that produces the output you are currently reading.\n 4. The Docker daemon streamed that output to the Docker client, which sent it\n    to your terminal.\n\nTo try something more ambitious, you can run a Windows Server container with:\n PS C:\\> docker run -it mcr.microsoft.com/windows/servercore powershell\n\nShare images, automate workflows, and more with a free Docker ID:\n https://hub.docker.com/\n\nFor more examples and ideas, visit:\n https://docs.docker.com/get-started/\n
Run Code Online (Sandbox Code Playgroud)\n