This guide provides step-by-step instructions on how to set up the Azure Cosmos DB Emulator in a Docker container using the cosmos-emulator.sh
script.
- Open a terminal window.
- Navigate to the directory containing the
cosmos-emulator.sh
script. - Execute the script:
sh cosmos-emulator.sh
This script retrieves your local IP address, pulls the Azure Cosmos DB emulator Docker image, and starts the Docker container.
- Once the Docker container is up and running, open a new terminal window.
- Download the emulator's SSL certificate:
curl -k https://localhost:8081/_explorer/emulator.pem > ~/emulatorcert.crt
This command saves the certificate as emulatorcert.crt
in your home directory.
-
Navigate to the certificate's location (by default, it's your home directory):
-
Open the directory in Finder:
open .
- Locate
emulatorcert.crt
and double-click to open it in Keychain Access. - In Keychain Access, find the
localhost
certificate. - Double-click on the certificate.
- In the dialog, expand the "Trust" section.
- Set "When using this certificate" to "Always Trust".
- Close the dialog and authenticate if prompted.
- Access the Azure Cosmos DB Emulator's web interface at
https://localhost:8081/_explorer/index.html
in your browser. There should be no SSL errors. - You should be able to connect to the Cosmos Emulator through the SDK