title: Docker dotnet restore "Unable to load the service index for source https://api.nuget.org/v3/index.json."
body: <p>I added docker support(Windows) in visual studio to an asp.net core project. It runs fine in debug mode. But shows the error as below when in "Release" mode. I've tried switching to a different network (Hotspot over 4G) but still shows the same error message. </p>
  
  <p>Below is the generated docker file.</p>
  
  
  
  <pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-nanoserver-1809 AS base
  WORKDIR /app
  EXPOSE 80
  
  FROM mcr.microsoft.com/dotnet/core/sdk:2.2-nanoserver-1809 AS build
  WORKDIR /src
  COPY ["BlankSite/BlankSite.csproj", "BlankSite/"]
  RUN dotnet restore "BlankSite/BlankSite.csproj"
  COPY . .
  WORKDIR "/src/BlankSite"
  RUN dotnet build "BlankSite.csproj" -c Release -o /app
  
  FROM build AS publish
  RUN dotnet publish "BlankSite.csproj" -c Release -o /app
  
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app .
  ENTRYPOINT ["dotnet", "BlankSite.dll"]
  </code></pre>
  
  <p>Error Message:</p>
  
  <pre><code>&gt;Step 7/18 : RUN dotnet restore "BlankSite/BlankSite.csproj"
  1&gt; ---&gt; a406dac3ca1d
  1&gt; ---&gt; Running in 38089ed5e181
  1&gt;C:\Program Files\dotnet\sdk\2.2.300\NuGet.targets(121,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\src\BlankSite\BlankSite.csproj]
  1&gt;C:\Program Files\dotnet\sdk\2.2.300\NuGet.targets(121,5): error :   No such host is known [C:\src\BlankSite\BlankSite.csproj]
  1&gt;The command 'cmd /S /C dotnet restore "BlankSite/BlankSite.csproj"' returned a non-zero code: 1
  1&gt;C:\Users\vincentliao\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.7.9\build\Container.targets(196,5): error CTP1001: An error occurred while attempting to build Docker image.
  </code></pre>