https://github.com/dotnet/dotnet-docker-samples/tree/master/aspnetapp https://github.com/dotnet/dotnet-docker-samples/tree/master/aspnetapp
Docker命令docker build -t aspnetapp
.
我收到 docker build 命令的错误:
C:\Program Files\dotnet\sdk\2.1.105\NuGet.targets(104,5): 错误:无法加载源的服务索引https://api.nuget.org/v3/index.json https://api.nuget.org/v3/index.json。 [C:\app\aspnetapp.csproj]
[1]PS C:\Users\pssharma\dotnet-docker-samples\aspnetapp> docker build -t aspnetapp .
Sending build context to Docker daemon 2.444MB
Step 1/10 : FROM microsoft/aspnetcore-build:2.0 AS build-env
---> eb21d939e0d8
Step 2/10 : WORKDIR /app
---> Using cache
---> d4ec30216ed7
Step 3/10 : COPY *.csproj ./
---> Using cache
---> 2ff39b5e6cb4
Step 4/10 : RUN dotnet restore
---> Running in 776764a35311
Restoring packages for C:\app\aspnetapp.csproj...
Restoring packages for C:\app\aspnetapp.csproj...
C:\Program Files\dotnet\sdk\2.1.105\NuGet.targets(104,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\app\asp
C:\Program Files\dotnet\sdk\2.1.105\NuGet.targets(104,5): error : An error occurred while sending the request. [C:\app\aspnetapp.csproj]
C:\Program Files\dotnet\sdk\2.1.105\NuGet.targets(104,5): error : The operation timed out [C:\app\aspnetapp.csproj]
以下命令返回非零代码:1
powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; dotnet restore
当主机存在多个网络适配器并且所述适配器的优先级配置错误时,就会出现这种情况。运行以下命令以显示网络适配器表:
Get-NetIPInterface -AddressFamily IPv4 | Sort-Object -Property InterfaceMetric -Descending
你希望你的主适配器(在我的例子中是wifi)具有lowest接口公制。
Set-NetIPInterface -InterfaceAlias 'Wi-Fi' -InterfaceMetric 1
My network adaptor table for reference:
请参阅此 github 线程以获取更多信息:https://github.com/docker/for-win/issues/2760#issuecomment-430889666 https://github.com/docker/for-win/issues/2760#issuecomment-430889666
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)