title: Dotnet Restore fails in docker build
body: <p>Hello i am trying to <code>dockerize</code> a <code>ASP NET Core 2.1</code> application and the <code>docker build</code> fails when it executes <code>dotnet restore</code>.
  I have already checked other threads for this specific problem  <br> <em><a href="https://stackoverflow.com/questions/41185443/nuget-connection-attempt-failed-unable-to-load-the-service-index-for-source">Nuget connection attempt failed &quot;Unable to load the service index for source&quot;</a></em>.<br></p>
  
  <p>The solutions provided there did not help me.</p>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>ARG serverPath=./Core/Server
  
  FROM microsoft/dotnet:sdk AS build-env
  WORKDIR /app
  
  
  COPY ./Core/Server/*.csproj ./
  RUN dotnet restore  //fails here
  
  COPY ./Core/Server/ ./
  RUN dotnet publish -c Release -o out  
  
  
  FROM microsoft/dotnet:2.1-aspnetcore-runtime 
  WORKDIR /app
  COPY --from=build-env /app/out  .
  ENTRYPOINT ["dotnet","Server.dll"]
  </code></pre>
  
  <p><strong>Output of docker build</strong></p>
  
  <pre><code>$ docker build -t server .
  Sending build context to Docker daemon  11.13MB
  Step 1/11 : ARG serverPath=./Core/Server
  Step 2/11 : FROM microsoft/dotnet:sdk AS build-env
   ---&gt; 343e2dc38168
  Step 3/11 : WORKDIR /app
   ---&gt; Using cache
   ---&gt; e9b75480ecb9
  Step 4/11 : COPY ./Core/Server/*.csproj ./
   ---&gt; Using cache
   ---&gt; 2de864bedf6a
  Step 5/11 : RUN dotnet restore 
   ---&gt; Running in 2fc6963e7e2c
    Restoring packages for /app/Server.csproj...
  /usr/share/dotnet/sdk/2.2.100/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/app/Server.csproj]
  /usr/share/dotnet/sdk/2.2.100/NuGet.targets(114,5): error :   The SSL connection could not be established, see inner exception. [/app/Server.csproj]
  /usr/share/dotnet/sdk/2.2.100/NuGet.targets(114,5): error :   Authentication failed because the remote party has closed the transport stream. [/app/Server.csproj]
  The command '/bin/sh -c dotnet restore -p:RestoreUseSkipNonexistentTargets=false -nowarn:msb3202,nu1503' returned a non-zero code: 1
  </code></pre>