1

I have a ASP.NET Core api for which I want to build a Docker image using VisualStudio 2017. I used Add Docker Support -> Linux and it generated the Dockerfile, and as I want to use a NuGet.Config file, I modified it consequently (COPY NuGet.Config .) and I use the NuGet.Config file during dotnet restore as you can see below:

FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY NuGet.Config ./
COPY ["Stock.Api/Stock.Api.csproj", "Stock.Api/"]
COPY ["Business/Stock/Stock.csproj", "Business/Stock/"]
COPY ["Business/Stock.Dto/Stock.Dto.csproj", "Business/Stock.Dto/"]
RUN dotnet restore --configfile NuGet.Config "Stock.Api/Stock.Api.csproj"
COPY . .
WORKDIR "/src/Stock.Api"
RUN dotnet build "Stock.Api.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "Stock.Api.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Stock.Api.dll"]

And here is the NuGet.Config file I use which has two NuGet feeds, a public https://api.nuget.org/v3/index.json and a LOCAL private feed http://192.168.40.100:3000/nuget (192.168.40.100 is my local @IP)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
     <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
     <add key="MYPRIVATEFEED" value="http://192.168.40.100:3000/nuget" />
   </packageSources>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
</configuration>

Using VS2017, I try to build the Docker image, and it fails with a timeout at the step 10 during dotnet restore as you can see:

Step 10/19 : RUN dotnet restore --configfile NuGet.Config     "Stock.Api/Stock.Api.csproj"
3> ---> Running in 5c8827a8d62d
3>  Restoring packages for /src/Business/Stock/Stock.csproj...
3>  Retrying 'FindPackagesByIdAsyncCore' for source 'http://192.168.40.100:3000/nuget/FindPackagesById()?id='Dto.Base'&semVerLevel=2.0.0'.
3>  The HTTP request to 'GET http://192.168.40.100:3000/nuget/FindPackagesById()?id='Dto.Base'&semVerLevel=2.0.0' has timed out after 100000ms.

I don't know why there is a timeout because the local feed is within my local computer. I modified the DNS using Docker for Desktop to automatic to static, I tried a lot of things I found on internet, but without any success.

Does anybody have a clue ?

Thank you very much

1
  • Hi,It seems that docker cannot access my host nor any host within my local network, but I do not know how to solve it? Commented Nov 6, 2019 at 17:16

1 Answer 1

1

For those who are interested in the questions and encounter the same issue, I finally uninstall Docker, and reinstall it, and set everything up again, and it worked as before… Need to look and learn how Docker networking works…

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.