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

Hi @Isaiahakello

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.

I hope this information helps!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct