Cosmo DB docker linux does not work on custom port

Andrey Lopatin 0 Reputation points
2023-03-12T07:26:04.51+00:00

Hello, I am facing the same problem as it was described here https://github.com/Azure/azure-cosmos-db-emulator-docker/issues/50

Basically, I would like to run cosmos DB container using a custom port (not 8081). If I have my application running as a docker - everything works as expected once I install the certificate following the official guide.

However, if I try to connect to the same cosmos DB container from a VS while developing my project - I cannot, Cosmos SDK just hangs forever

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,470 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Daryl Van Sittert 0 Reputation points
    2024-01-25T11:33:08.3866667+00:00

    After a lot of digging trying to do this myself, I found myself in the /usr/local/bin/cosmos/start.sh file on the cosmos emulator. In that file, it executes Microsoft.Azure.Cosmos.Emulator.exe with a variable at the end for any other parameter that you want.

    So by adding an environment variable passing port, you can run this on any port that you want. Keep the enable preview flag because this is the default value for this parameter. AZURE_COSMOS_EMULATOR_ARGS='/port=18081 /enablepreview'

    So the full docker run might be something like: docker run --publish 18081:18081 --publish 10250-10255:10250-10255 -e AZURE_COSMOS_EMULATOR_ARGS='/port=18081 /enablepreview' -e AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=192.168.1.10 mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest

    0 comments No comments