github/dotnet/dotnet-docker-样本/树/主/ aspnetapp
Docker命令 docker build -t aspnetapp 。
我在docker build命令中遇到错误
I am getting an error for docker build command as
C:\Program Files \dotnet\sdk\2.1.105\NuGet.targets(104,5):错误:无法加载源 api.nuget/v3/index.json 。 [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 api.nuget/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 api.nuget/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
The following command returned a non-zero code: 1
powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; dotnet restore推荐答案
对我来说,此问题是随机出现的(以及多个类似的问题,例如如为nuget拒绝权限等。要解决此问题,请重新启动Visual Studio)对于 windows ,已通过重新启动docker服务并重新启动Visual Studio(2017)进行了修复。
For me, this issue appeared randomly (along with multiple similar issues, such as "permission denied for nuget" etc. To fix that, restart Visual Studio) For windows, it was fixed by restarting docker service and restarting Visual Studio (2017).
更多推荐
无法加载源https://api.nuget.org/v3/index.json的服务索引。 [C:\app\aspnetapp.csproj]
发布评论