Skip to content

Instantly share code, notes, and snippets.

@RaphaelDeLaGhetto
Forked from marufshidiq/HOWTO.md
Created May 13, 2022 22:20
Show Gist options
  • Save RaphaelDeLaGhetto/84079074a232443f9fa25bafabeccbd8 to your computer and use it in GitHub Desktop.
Save RaphaelDeLaGhetto/84079074a232443f9fa25bafabeccbd8 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment