Skip to content

Instantly share code, notes, and snippets.

@davichoso
Forked from marufshidiq/HOWTO.md
Created October 22, 2021 16:01
Show Gist options
  • Save davichoso/8431509abbb8dc9fe6db5f8f54292f5d to your computer and use it in GitHub Desktop.
Save davichoso/8431509abbb8dc9fe6db5f8f54292f5d to your computer and use it in GitHub Desktop.
Backup and Restore mongodb inside docker-compose container

How to backup

docker-compose exec -T <mongodb_service_name> mongodump --archive --gzip --db <mongodb_database> > dump.gz

How to restore

docker-compose exec -T <mongodb_service_name> mongorestore --archive --gzip < dump.gz
@davichoso
Copy link
Author

awesome! it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment