Hi,
I would like to spin up a local mongodb atlas cluster in a docker compose and use it for my local tests. I have followed this guide (link). Unfortunately I get an error in the container when adding the volume for persisting the data.
This is my compose file:
version: "3.8"
services:
mongodb:
image: mongodb/mongodb-atlas-local
environment:
- MONGODB_INITDB_ROOT_USERNAME=usr
- MONGODB_INITDB_ROOT_PASSWORD=password
ports:
- 27017:27017
healthcheck:
test: echo "try { rs.status() } catch (err) { print('Replica set on mongodb not initialized'); quit(1); }" | mongosh --port 27017 --quiet
interval: 5s
timeout: 30s
start_period: 0s
retries: 30
volumes:
- "data:/data/db"
volumes:
data:
It runs perfect without the mounted volume.