export GOPRIVATE=github.com/<your github url>/<Private repo name>
Use the above command to export the go module in your docker instead of the above syntax. When I am using this command for fetch private go modules in my local machine