Dan*_*iel 4 c# nuget docker asp.net-core asp.net-core-2.2
拥有 ASP.NET Core 2.2 Web 应用程序,我尝试在合作代理后面恢复 NuGet 包
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS sdk-image
WORKDIR /app/
ARG HTTP_PROXY
ENV HTTP_PROXY ${HTTP_PROXY}
ENV HTTPS_PROXY ${HTTP_PROXY}
COPY MyProject.csproj .
RUN dotnet restore
Run Code Online (Sandbox Code Playgroud)
具有以下内容docker-compose.yml:
version: '2'
services:
tool:
build:
context: .
args:
http_proxy: ${HTTP_PROXY}
networks:
default:
ipam:
driver: default
config:
- subnet: 192.168.239.0/21
Run Code Online (Sandbox Code Playgroud)
由于 Docker 的默认网络与内部公司范围冲突,网络被覆盖。HTTP_PROXY在主机上设置为完整的 url,例如http://user:password@proxy.internal:81.
运行时docker-compose up --build恢复失败:
Step 7/15 : RUN dotnet restore
---> Running in 62c8bb6f2f72
/usr/share/dotnet/sdk/2.2.402/NuGet.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/app/MyProject.csproj]
/usr/share/dotnet/sdk/2.2.402/NuGet.targets(123,5): error : GSSAPI operation failed with error - An unsupported mechanism was requested (Unknown error). [/app/MyProject.csproj]
ERROR: Service 'tool' failed to build: The command '/bin/sh -c dotnet restore' returned a non-zero code: 1
Run Code Online (Sandbox Code Playgroud)
我找不到关于这个问题的太多信息。Github 问题通过本地 TFS 解决了这个问题。但我没有任何自托管存储库,只有我和 NuGets 服务器之间的公司代理。
Lio*_*ion 11
似乎这是当代理需要 NTLM 时引起的,但缺少相应的库。我在公司代理背后遇到了这个问题,并通过gss-ntlmssp在 Docker 中安装如下所示的包来修复它:
RUN apt-get install -y gss-ntlmssp
Run Code Online (Sandbox Code Playgroud)
安装这些包后,用于获取 NuGet 包的代理身份验证工作正常。
| 归档时间: |
|
| 查看次数: |
10688 次 |
| 最近记录: |