Search code examples
c#dockerasp.net-coredocker-composeoffline

Docker compose in asp.net core offline (no internet connexion) : unable to load the service index for source


I am using an offline machine of a company (without internet connexion). When I do docker-compose, I have the error : Unable to load service index for source https://api.nuget.org/v3/index.json. (Which is normal because I have no internet on my machine). The problem is, even though I changed the Nuget.config file (so the path "https://api.nuget.org/v3/index.json" is no longer in Nuget.config), I still have the same error:

Error: Unable to load service index for source

Here you have the docker file of my service : Dockerfile

And the docker-compose: docker-compose file

Thank you for your help.


Solution

  • When you do the dotnet restore in the Dockerfile, you've only copied the .csproj file into the container.

    Copy the nuget.config file into the container as well, before doing dotnet restore.