What is the correct path for mapping a directory into the cosmosDB emulator linux docker image so that data (databases) are persisted on the host file system?
cosmosdb:
container_name: cosmosdb
image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest
mem_reservation: 3G
cpu_count: 2
tty: true
ports:
- "8081:8081"
- "8900:8900"
- "8901:8901"
- "8979:8979"
- "10250:10250"
- "10251:10251"
- "10252:10252"
- "10253:10253"
- "10254:10254"
- "10255:10255"
- "10256:10256"
- "10350:10350"
environment:
AZURE_COSMOS_EMULATOR_PARTITION_COUNT: 3
AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE: true
AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE: 127.0.0.1
volumes:
- ???
For Windows it seems to be
C:/CosmosDB.Emulator/bind-mount
I already have taken a look into the running image but i have no clue in which directoy database/data files are stored...
As so often the docu is rather short https://learn.microsoft.com/en-us/azure/cosmos-db/linux-emulator?tabs=sql-api%2Cssl-netstd21
and it just says
If the Cosmos DB emulator data folder is "volume mounted", ensure that the volume has enough space and is read/write.
But what is the data folder? ;)
/tmp/cosmos/appdata
found it by running docker in interactive and the the "find / cosmos" command... i didnt get any found results but it output a list of all the directories it scanned... and i found that path. just tested and it works.
this is my docker-compose
version: '3.7'
networks:
default:
external: false
ipam:
driver: default
config:
- subnet: "172.16.238.0/24"
services:
cosmosdb:
container_name: "azurecosmosdbemulatorcontainer"
hostname: "azurecosmosdbemulatorhostname"
image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
platform: linux
stdin_open: true
tty: true
mem_limit: 3GB
ports:
- '8081:8081'
- '8900:8900'
- '8901:8901'
- '8902:8902'
- '10250:10250'
- '10251:10251'
- '10252:10252'
- '10253:10253'
- '10254:10254'
- '10255:10255'
- '10256:10256'
- '10350:10350'
environment:
AZURE_COSMOS_EMULATOR_PARTITION_COUNT: 2
AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE: true
AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE: ${External_IP}
networks:
default:
ipv4_address: 172.16.238.246
volumes:
- cosmosdrive:/tmp/cosmos/appdata
volumes:
cosmosdrive:
recipientdrive:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With