It seems like the issue you are facing is related to the configuration of the Azure Cosmos DB emulator for the Mongo API. There are a few things you can try to resolve the issue:
- Check the Docker logs: You can check the container logs for more details about the error by running the following command in your terminal: docker logs local.cosmosdb This should give you more information about the specific error that caused the container to exit with code 255.
- Verify the Azure Cosmos DB emulator version: Make sure you are using the latest version of the Azure Cosmos DB emulator for the Mongo API. You can find the latest version on the Azure Cosmos DB Emulator release page on GitHub.
- Check the environment variables: Double-check that all the environment variables in your docker-compose.yml file are correct. You can try removing the AZURE_COSMOS_EMULATOR_ENABLE_MONGODB_ENDPOINT environment variable to see if the emulator starts correctly without it.
- Increase memory limit: You can try increasing the memory limit for the container by changing the value of the mem_limit environment variable in the docker-compose.yml file. For example, you can try setting it to 4g or higher.
- Disable persistence: Try disabling data persistence by setting the AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE environment variable to false. This can help isolate the issue and narrow down the potential causes.
- Use SQL endpoint: The error message "Invalid endpoint type enabled; only SQL endpoint type is supported" suggests that the emulator may not be configured correctly for the Mongo API. You can try using the SQL endpoint instead by setting the AZURE_COSMOS_EMULATOR_ENABLE_SQL_API environment variable to true.
- Check for conflicts with other services: Make sure that there are no other services running on the same ports as the Azure Cosmos DB emulator. You can try changing the port mappings in the docker-compose.yml file to use different ports, or stopping any other services that may be conflicting with the emulator. I hope these suggestions help you resolve the issue with starting the Azure Cosmos DB emulator for the Mongo API using Docker.