I am receiving the following error when attempting to call dotnet restore against my .net core 2.2 solution.
OS: Windows 10
Docker Desktop Version: 2.1.0.3 (38240)
Image:microsoft/dotnet:2.2-sdk
The error is:
/usr/share/dotnet/sdk/2.2.401/NuGet.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json.
/usr/share/dotnet/sdk/2.2.401/NuGet.targets(123,5): error : The SSL connection could not be established, see inner exception.
/usr/share/dotnet/sdk/2.2.401/NuGet.targets(123,5): error : The remote certificate is invalid according to the validation procedure.
The command ‘/bin/sh -c dotnet restore ’ returned a non-zero code: 1
I can execute this same docker file on a build VM that is running docker 2.0.0.3
Step 12/19 : RUN dotnet restore --configfile "NuGet.Config"
---> Running in 9fa63f737600
Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/***/2e8805f8-fae2-4710-
8fc1-3fc00f2c5e6e/_packaging/6098c654-d8c0-45c7-ba19-
cdff51c0e06c/nuget/v3/flat2/microsoft.aspnetcore.httpspolicy/index.json'.
The SSL connection could not be established, see inner exception.
Authentication failed because the remote party has closed the transport stream.
Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/***/2e8805f8-fae2-4710-
8fc1-3fc00f2c5e6e/_packaging/69e14ca1-38fe-4f61-97a9-
0bb4f84f87e3/nuget/v3/flat2/microsoft.aspnetcore.httpoverrides/index.json'.
The SSL connection could not be established, see inner exception.
Authentication failed because the remote party has closed the transport stream.
Encounter the same error while building .net app in docker
> docker build -t worker-app .
> Sending build context to Docker daemon 59.39kB
> Step 1/10 : FROM mcr.microsoft.com/dotnet/core/sdk:3.1 as builder
> ---> ab912b6b0d27
> Step 2/10 : WORKDIR /Worker
> ---> Using cache
> ---> a6a407794f68
> Step 3/10 : COPY src/Worker/Worker.csproj .
> ---> Using cache
> ---> e5e68895e7df
> Step 4/10 : RUN dotnet restore
> ---> Running in fd6a73aeb757
> Determining projects to restore...
> /usr/share/dotnet/sdk/3.1.417/NuGet.targets(128,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/Worker/Worker.csproj]
> /usr/share/dotnet/sdk/3.1.417/NuGet.targets(128,5): error : The SSL connection could not be established, see inner exception. [/Worker/Worker.csproj]
> /usr/share/dotnet/sdk/3.1.417/NuGet.targets(128,5): error : The remote certificate is invalid according to the validation procedure. [/Worker/Worker.csproj]
> The command '/bin/sh -c dotnet restore' returned a non-zero code: 1