.net core + Docker: The remote certificate is invalid according to the validation procedure

Ale*_*lex 5 https docker asp.net-core-2.0 windows-container

What is the correct way for multiple Windows containers running a .net core application to trust each other's HTTPS certificates?

I have the following setup:

  • Container A is running a REST service which is required by Container B
  • Container B calls the REST service with an HttpClient
  • Container B does something with the result

The problem is, that when B calls A, I got a The remote certificate is invalid according to the validation procedure. exception. This is the demo code I use:

var dummy = new HttpClient
{
    BaseAddress = new Uri("https://container-a")
};
var res = await dummy.GetAsync("/api/test-endpoint");
Run Code Online (Sandbox Code Playgroud)

I have no idea and did not find any useful information on how to set up the containers to trust each other. The only solution I found is to override the https trust check and this is, in my opinion, unacceptable.