kanils_
kanils_

Reputation: 425

Issue with HTTPS connection to CosmosDb Emulator in Linux Docker Container

A new Linux emulator for CosmosDb was recently announced.

I'm using Docker for Windows. And there is a problem with the connection to CosmosDb Emulator in Linux Docker Container via ASP.NET Core.

The Docker container with the emulator launched successfully and I can reach the explorer by: http://localhost:8081/_explorer/index.html

enter image description here

Then I run the project in Visual Studio and get that problem

The SSL connection could not be established

enter image description here

I've tried to install a certificate from this guide but my host is Windows and it doesn't work for me.

Could you please suggest how to install the certificate for Linux container on Windows host?

Upvotes: 4

Views: 1740

Answers (1)

Roman
Roman

Reputation: 21

You have to download certificate from Docker container to your host machine and install it (PowerShell):

#Download certificate from container
Invoke-RestMethod -Uri https://$($ipAddress):8081/_explorer/emulator.pem -Method Get | Out-File "$($env:TEMP)/emulatorcert.crt"

#Import certificate
$cert = Import-Certificate -FilePath "$($env:TEMP)/emulatorcert.crt" -CertStoreLocation Cert:\LocalMachine\Root

Upvotes: 2

Related Questions