I am building a CosmosDB Emulator
container via a docker-compose.yml
file.
version: '3.4'
services:
cosmosdb:
container_name: cosmosdb
image: "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest"
tty: true
mem_limit: 2G
cpu_count: 2
environment:
- AZURE_COSMOS_EMULATOR_PARTITION_COUNT=10
- AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=true
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'
volumes:
- vol_cosmos:/data/db
volumes:
vol_cosmos:
I then generate some data in it via the CosmosDB Emulator Explorer
. However, if I delete the container
I lose all the data, even though the container
uses the specified volume
, and the volume
is not deleted ever.
Either I don't understand how volumes
work, or something else is wrong, but I am looking for a way to persists the data even after deleting the container
. A new one should just use the volume
with the specified name if it exists, or create a new one if it doesn't, right?
The data stays intact after container
and/or OS restarts. It just doesn't persist after deleting the container
.