.NET Core build in docker linux container fails due to SSL authentication to Nuget

ANSWERING TO MYSELF

It was not a Linux container issue, it is a certificate issue in the web server (IIS), because we are using self-signed certificates and in this way the cert will be always an invalid certificate. Self-signed certs works okay on Windows OS side, doesn't matter the invalid error. Of course self-signed certs are just for a test environment or so.

From Linux OS when you are trying to pull packages from NuGet you will get the error below, because:

1) The cert is indeed invalid, and

2) because apparently there is not an option to ignore an invalid certificate from Linux side.

The SSL connection could not be established, see inner exception.
The remote certificate is invalid according to the validation procedure.

The solution is you are working in a corporate environment, is to request to System Administrator a proper signed certificate, for that you generate a CSR from your web server, in my case IIS, then pass it to them, so they will send you back a .cer file to install in that web server.

The other option that I was trying to do but I couldn't due to the limitations of my corporate environment, is to create a fake CA (with OpenSSL), then you sign the CSR's yourself to have some valid certificates for your Dev or test environment.

Apologizes for answering this myself, but I believe it is worth to share my findings.

Hope it helps.