Home > Software engineering >  Docker compose build/Docker build connection refused to nuget at macos
Docker compose build/Docker build connection refused to nuget at macos

Time:01-19

I've got a problem with building .NET 5 solutions using docker compose build or docker build. Image which i'm using for building is: mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim The problem is that when I'm trying to build it on my machine (MacOS Monterey, intel) I've got following error with restoring nuget packages from the private feed:

#19 6.349 Failed to download package 'System.Runtime.CompilerServices.Unsafe.4.5.1' from 'https://XXXX.pkgs.visualstudio.com/_packaging/96ca4348-f8c1-4150-b19f-3dab0cf807bf/nuget/v3/flat2/system.runtime.compilerservices.unsafe/4.5.1/system.runtime.compilerservices.unsafe.4.5.1.nupkg'. #19 6.349 Connection refused (pyvvsblobprodsu6weus63.blob.core.windows.net:443) #19 6.349 Connection refused #19 6.357 Failed to download package 'Microsoft.Azure.Storage.Common.11.2.3' from 'https://XXXX.pkgs.visualstudio.com/_packaging/96ca4348-f8c1-4150-b19f-3dab0cf807bf/nuget/v3/flat2/microsoft.azure.storage.common/11.2.3/microsoft.azure.storage.common.11.2.3.nupkg'. #19 6.357 Connection refused (wg0vsblobprodsu6weus89.blob.core.windows.net:443) #19 6.357 Connection refused

I'm copying nuget.config with credentials in dockerfile like

COPY nuget.config /

Here is my nuget.config copied to the container:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="NuGet V3" value="https://api.nuget.org/v3/index.json" />
        <add key="DDDDD" value="https://XXXX.pkgs.visualstudio.com/_packaging/DDDDD/nuget/v3/index.json" />
    </packageSources>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
  <config>
     <add key="repositoryPath" value="packages" />
  </config>
    <packageSourceCredentials>
      <DDDDD>
      <add key="Username" value="SomeUsername" />
      <add key="ClearTextPassword" value="SomePassword" />
    </DDDDD>
</packageSourceCredentials>
</configuration>

Commands which i'm using to build containers: docker compose up -d docker build . -F API/Dockerfile It's failing for both of them.

Can anybody tell me what's wrong? Maybe it's something with my machine setup?

CodePudding user response:

Self answer for people having the same issue as I had: The problem was the lack of this line in the nuget config: in config section like:

<config>
    <add key='maxHttpRequestsPerSource' value='10' />
    <add key="repositoryPath" value="packages" />
</config>

After adding this key, everything is working as expected. Keep in mind that your value for maxHttpRequestsPerSource may be different (less or more) so I advise doing a few experiments with other values.

  •  Tags:  
  • Related