MongoDB Data loss after a day
I have a docker project with Mongo DB, after a day or two…I keep losing the data
mongodb:
image: mongo:latest
container_name: mongo
ports:
- "27017:27017"
volumes:
- data:/data/db
mongo-express:
image: mongo-express
container_name: mongo-express
ports:
- "8081:8081"
environment:
- ME_CONFIG_MONGODB_SERVER=mongodb
volumes:
data:
what is the problem? and how can I solve it? thank you!
1 Reply
mcivitarese
Linode Staff
You may need to make the data persist using a volume. I found these resources that may help get you pointed in the right direction.
- Using MongoDB with Docker - Persisting Data With Volumes
- Persistent Databases Using Docker’s Volumes and MongoDB
- Stop VM with MongoDB docker image without losing data
I hope this information helps!