My team is running into an intermittent but highly challenging issue with locally building .NET services in Docker. It’s not uncommon for docker build to fail with the error message “NU1301: Unable to load the service index for source”, followed by the URL of our Azure Artifacts feed, when trying to run dotnet build. This completely blocks our ability to run our services locally in Docker or Docker Compose. It never fixes itself, and when using cache mounts, it causes the build to fail out entirely after a few attempts. (It occurs with or without cache mounts.)
We’re not using any proxies, just a VPN. I can turn off the VPN and still see this issue.
My authentication method (a Personal Access Token from Azure DevOps) is valid, and all our package dependencies/versions are compatible.
We are using the dotnet/sdk:6.0 image, and all projects in the solution are using .NET 6 in turn. Everything builds & runs absolutely fine in vanilla Visual Studio, but when I move to Docker Compose, the Docker-Visual Studio integration, or the raw Docker CLI it fails out. We do not have a workaround beyond skipping this stage and relying on Visual Studio magic to mount all the necessary DLLs, but we are loath to proceed with this indefinitely as we want confidence that things build correctly in a Linux environment before we push code changes to main.
We are using Windows 10, and our standard Docker Desktop version is 4.24.2.