Docker.DotNet: AuthenticationException: The remote certificate is invalid according to the validation procedure.

public async Task<IList<ContainerListResponse>> GetContainers()
        {
            ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;
            var credentials = new CertificateCredentials(new X509Certificate2(@"D:\Data\key.pfx", "123456"));
            ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;
            var client = new DockerClientConfiguration(new System.Uri("https://192.168.0.5:2376"), credentials).CreateClient();
            IList<ContainerListResponse> containers = await client.Containers.ListContainersAsync(new ContainersListParameters()
            {
                Limit = 10,
            });

            return containers;
        }

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@galvesribeiro Yes, i tested IP/host and cert files with postman image