I had created a docker-compose file for building a full environment which included a Cosmos DB emulator. However I found the client code - running locally on Visual Studio could not connect to the emulator. It would hang indefinitely (even with HTTP request timeouts overriden in the Client Factory).
I ran the emulator as a local service (not containerised) and this worked, indicating a problem specific to the container.
I found the error was the missing environment variable
This is required otherwise the emulator returns an IP address the client cannot connect to.
My docker-compose file now included the following variables: