I thought of posting a question that I answered in Microsoft Q&A

Many customers were struggling to containerize .NET Web Api project in Visual Studio 2022. The error message was shown as below:

Step 14/23 : RUN dotnet restore "API.Authentication/API.Authentication.csproj" ---> Running in 36ddc34cd2a1 Determining projects to restore... C:\src\Shared.Kernel\Shared.Kernel.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\src\API.Authentication\API.Authentication.csproj]

And my solution is as follows:

This mostly looks like a docker desktop dns config issue.

Adding DNS Server into Docker Engine should solve the problem:

Steps:-

1. Open Docker Desktop application
2. Go to Setting
3. Go to Docker Engine
4. Add DNS tag in setting configuration as below
    "dns":["1.1.1.1","8.8.8.8"],

Tags:

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Comments