Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\app\aspnetapp.csproj]

后端 未结 13 1583
温柔的废话
温柔的废话 2021-02-12 01:45

https://github.com/dotnet/dotnet-docker-samples/tree/master/aspnetapp

Docker command docker build -t aspnetapp.

I am getting an error for docker bui

相关标签:
13条回答
  • 2021-02-12 02:13

    I got this resolved on my Windows 10 Machine by Disabling Avast Antivirus and unInstalling McAffee Antivirus.

    • Right click the Avast Icon in the Notification Tab
    • Select Avast Shields Control
    • Click on "Disable Until Computer is Restarted".

    And you can now run the Docker Build Successfully. I can give Further Assistance if needed.

    0 讨论(0)
  • 2021-02-12 02:15

    Just add --network=host option to docker build

    docker build -t aspnetapp . --network=host

    0 讨论(0)
  • 2021-02-12 02:15

    Had the same issue, the problem was a missing dependency used by NuGet.

    I am using the microsoft/dotnet:sdk image, and it works after installing libcurl3 to my image.

    Try adding RUN apt-get update && apt-get install -y libcurl3 to your Dockerfile before restoring.

    if it doesn't work, try restarting your Docker instance.

    edit: if that doesn't help you, there is this open issue on the NuGet github where some people are trying to solve the same problem.

    edit2:added Ignas solution: restarting docker instance.

    0 讨论(0)
  • 2021-02-12 02:16

    If the issue is caused by your organisation's self-signed certificates, you can fix it by:

    1. Get the certificate file (*.cer) provided by your IT department.
    2. Copy it into the SSL certificate location: COPY ["./combined.cer", "/etc/ssl/certs/"]
    3. Update SSL cert list: RUN update-ca-certificates

    These steps work for Debian, need to be adapted for other distros.

    0 讨论(0)
  • 2021-02-12 02:18

    I had the same issue on Debian 9. I fudge the error with disconnecting from local network. It works for me because I did not change anything on codebase and I do not need to get packages from nuget.

    0 讨论(0)
  • 2021-02-12 02:21

    I'm suprised no one said this already. This was caused by not having the latest sdk installed. In my case docker was looking for the file

    C:\Program Files\dotnet\sdk\3.1.302\NuGet.targets

    However this file did not exist on my machine instead I had a different minor version.

    C:\Program Files\dotnet\sdk\3.1.301\NuGet.targets

    I'm sure they're away to get it working using an older version, but in my case I just updated the downloaded the latest sdk

    0 讨论(0)
提交回复
热议问题