I little confused with Linux docker and cosmos db emulator. I have an emulator installed on my local machine. On my Windows 10 I have a Linux docker container with Web API ASP.NET core application. When I try to get access from container to cosmos db I get an exception -> HttpRequestException: Connection refused.
In C# code I get needed options like AuthKey and Uri to database from environment variables. Looks like I have an issue with network between container and localhost but I can not understand how I can connect these.
Below provided docker-compose.yml and docker-compose.override.yml files.
event.webapi:
container_name: event.webapi
image: '${DOCKER_REGISTRY-}eventwebapi'
environment:
**- AzureCollectionName=Events
- AzureDatabaseName=EventsDatabase**
build:
context: .
dockerfile: src/Services/Event/Event.WebApi/Dockerfile
``` docker-compose.override.yml
event.webapi:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
- ASPNETCORE_HTTPS_PORT=44378
**- AzureEndpointUri=https://127.0.0.1:8081
-AzurePrimaryKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==**
ports:
- "53753:80"
- "44378:443"
volumes:
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro