Issue with Docker build with nuget

I am getting following error when trying to build project by using "docker build ." command. Same is working fine when running from Visual Studio 2019.

Determining project to restore…
C:Program Filesdotnetsdk.1.402NuGet.targets(128,5): error : Unable to load the service index for source

the strange thing is, i have only sdk 3.1.302 installed on my system.but docker referencing folders for version 3.1.402.

Kindly let me know where i can set the path of sdk versions in docker desktop.

Source: Docker Questions