azure-cosmos-db-emulator-docker
azure-cosmos-db-emulator-docker copied to clipboard
Unable to use Mongo API when running in Docker Desktop
Describe the bug I am unable to use Cosmos DB with Mongo API for local development when running on Windows using Docker Desktop and WSL 2. The data explorer shows SQL API even though I specify I want to use the Mongo API. Using to mongoshell seems to work to add some database entries so maybe this is just a problem with the data explorer? Link to mongsh I used.
To Reproduce
Run the command docker compose up -d or run the docker run command. Both examples further down.
Expected behavior I expect the data explorer to use Mongo API instead of SQL API.
Screenshots
I manage to create some database entries using the mongo shell but then I get this error in the data explorer:
Desktop (please complete the following information):
- Processor 13th Gen Intel(R) Core(TM) i9-13900H 2.60 GHz
- Installed RAM 32,0 GB (31,6 GB usable)
- System type 64-bit operating system, x64-based processor
- Edition Windows 11 Pro
- Version 22H2
- OS build 22621.521
- Experience Windows Feature Experience Pack 1000.22634.1000.0
Browsers:
- Brave v1.63.174
- Microsoft Edge Version 122.0.2365.80 (Official build) (64-bit)
**Docker Images Used: **
- mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:mongodb
**Arguments && Environment variables to start Docker: I have tried both the docker run command specified in this guide: (Link to guide) and constructed a docker compose file both with the same outcome.
version: "3.8"
services:
cosmos-db:
hostname: cosmos-db
domainname: local
image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:mongodb
container_name: cosmos-db
ports:
- "8081:8081"
- "10251-10255:10251-10255"
environment:
- AZURE_COSMOS_EMULATOR_ENABLE_MONGODB_ENDPOINT=4.0
tty: true
stdin_open: true
networks:
default:
name: docker_network
driver: bridge
driver_opts:
com.docker.network.bridge.host_binding_ipv4: 0.0.0.0
com.docker.network.driver.mtu: 1500
docker run \
--publish 8081:8081 \
--publish 10250:10250 \
--env AZURE_COSMOS_EMULATOR_ENABLE_MONGODB_ENDPOINT=4.0 \
--interactive \
--tty \
mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:mongodb
Docker Environment
- Docker Desktop
@sajeetharan Any updates on this?