Backup data from dockerized eventstore

Hi everyone,

I need to backup the data inside an eventstore container. Unfortunately, I dont have a volume created for this container yet.

Does anyone have any idea or faced this problem before?

Thank you!

Hi Leonardo,

You could use `docker cp` command to copy data from eventstore container to your host system:
      docker cp <container_name_or_id>:/var/lib/eventstore ./eventstore

It will copy eventstore's data to 'eventstore' folder in current directory.

For better results, you might be able to copy from a stopped container (assuming you didn't run it with `docker run --rm`), but I am not entirely sure about it, I sugges to experiment with another container first:
  docker stop <container_name_or_id>
  <docker cp like above above>

Hope this helps.

- Karolis

Thank you Karolis.

I was able to back up the folder.

If I want to restore from this folder, replacing the eventstore folder inside the container with the new one would be enough?

Thanks!

Hi, Leonardo,

I’m happy that it helped.

If I want to restore from this folder, replacing the eventstore folder inside the container with the new one would be enough?

Yes, I think so. If you do both actions on stopped ES instance, it should work.

In case you want to backup a running instance, please refer to docs: https://eventstore.org/docs/server/database-backup/index.html

  • Karolis

Karolis, I performed the backup and restore with stopped container. Unfortunately it didnt work.

All streams created were gone after restarting the container.

Any workaround for this?

thanks!

[UPDATE]
Karolis, finally i was able to restore the data. Binding the backed up folder to the container in docker compose was the solution to restore.

volumes:

  • ./eventstore/db:/var/lib/eventstore

Thanks a lot for the help!