Open Barsonax opened 10 months ago
When I use network_mode: host it does work so this seems to be networking related. Not clear to me yet what exactly but the docs don't mention anything about this.
This is not a real solution though as host networking has its own problems.
I managed to get it to work with this docker compose definition:
services:
cosmosdb:
image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest
container_name: "cosmosdb"
environment:
- AZURE_COSMOS_EMULATOR_PARTITION_COUNT=1
- AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=true
- AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=127.0.0.1
ports:
- 8081:8081
Hope this will help anyone who stumbles on this but the real fix is to update the docs.
AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE is apparently needed when running in a docker container. Probably because its in a different subnet. Was quite hard to find though that this is the fix.
I also noticed that it has to run on port 8081. If you let say map a different port to 8081 inside the container your app will simply hang for minutes.
Describe the bug Linux docker container runs but function app CosmosDBTrigger does nothing. Windows msi does work.
To Reproduce Steps to reproduce the behavior:
Start the cosmosdb container using this docker compose file
Ensure https certificate is trusted (NOTE: everytime you restart the container it seems to regenerate the cert so you need to trust it again, personally I find this gives a bad developer experience. It should reuse the same cert or even better give a option to ignore ssl errors in azure functions).
Run a azure function locally that uses CosmosDBTrigger. Notice how nothing happens, no errors are logged either. Leases are not created even if CreateLeaseContainerIfNotExists is set to true.
Expected behavior Atleast an error describing what went wrong or even better just make it work like the windows msi emulator.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Docker Images Used:
**Arguments && Environment variables to start Docker:
Docker Environment