【发布时间】:2021-01-23 01:22:49
【问题描述】:
关于环境的一点背景。 仅适用于 Cisco AnyConnect VPN 的企业环境,具有要设置的代理服务器以访问 git 或互联网,运行 Docker CE 最新版本和 linux 容器的 Windows 笔记本电脑。
我正在尝试https://dotnet.microsoft.com/learn/aspnet/microservice-tutorial/docker-image 中的微服务示例。 安装了几个 nuget 包以连接到同一 Web api 中的数据库。添加了一种显示数据库记录的方法。在主机中的 kestrel、IIS Express 和 IIS 的调试和发布模式下工作得非常好。 创建了一个包含以下内容的 docker 文件
# https://hub.docker.com/_/microsoft-dotnet-core
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /source
# copy csproj and restore as distinct layers
COPY *.sln .
COPY *.csproj .
RUN dotnet restore "ms.sln"
# copy everything else and build app
COPY . .
WORKDIR /source
RUN dotnet publish "ms.sln" -c release -o /app --no-restore
# final stage/image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build /app ./
ENTRYPOINT ["dotnet", "ms.dll"]
这是我在命令提示符下运行的构建命令。
docker build --build-arg HTTP_PROXY=http://server:port--build-arg HTTPS_PROXY=http://server:port -t microservice .
当它开始执行 dotnet restore 时.. 我收到了这个我不明白的错误。我什至在 docker 设置中设置了代理。
[build 5/8] RUN dotnet restore "ms.sln":
#12 0.843 Determining projects to restore...
#12 1.487 /usr/share/dotnet/sdk/3.1.402/NuGet.targets(128,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/source/ms.sln]
#12 1.487 /usr/share/dotnet/sdk/3.1.402/NuGet.targets(128,5): error : NTLM authentication is not possible with default credentials on this platform. [/source/ms.sln]
------
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c dotnet restore "ms.sln"]: runc did not terminate sucessfully
我已经阅读并尝试过的文章
http://codebuckets.com/2020/08/01/nuget-restore-failing-in-docker-container/
https://github.com/moby/moby/issues/24697
Windows containers have no internet access, but Linux containers do - with VPN-Client active on host
【问题讨论】:
-
您是否尝试过以小写和大写形式传递代理设置?例如
docker build --build-arg HTTP_PROXY=http://server:port --build-arg HTTPS_PROXY=http://server:port --build-arg http_proxy=http://server:port --build-arg https_proxy=http://server:port -t microservice . -
我现在试试@SimplyGed
-
同样的错误@SimplyGed
标签: windows docker .net-core docker-desktop linux-containers