我正在构建 Windows 映像,并且正在尝试安装 Chocolatey。但是,在 Chocolatey 的安装步骤中,我在尝试运行该命令时遇到下载超时。
这里是 Dockerfile,尝试使用 powershell 安装 Chocolatey。
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-20210112-windowsservercore-ltsc2019
SHELL ["powershell", "-Command"]
RUN New-Item -ItemType directory -Path $Env:SOME_USER_HOME; \
#Override the action to take in response to a non-terminanting error occurring, to STOP.
$ErrorActionPreference = 'Stop';
#Install chocolatey (https://chocolatey.org/docs/installation)
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Set-ExecutionPolicy Bypass -Scope Process -Force; \
$env:chocolateyUseWindowsCompression = 'true'; \
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
错误:
Exception calling "DownloadString" with "1" argument(s): "The operation has timed out" At line:1 char:179 + ... n = 'true'; iex((New-ObjectSystem.Net.WebClient).DownloadString('ht...
然后我尝试使用 Nuget CLI 安装 Chocolatey
RUN nuget install chocolatey
但我收到了类似的错误。
Unable to load the service index for source https://api.nuget.org/v3/index.json.
The HTTP request to 'GET https://api.nuget.org/v3/index.json' has timed out after 100000ms.
我做了以下测试: