Skip to content

ahm507/docker-mongo-backup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongo-backup

Use mongodump from official mongo image to make regularly backups of your mongo database with cron in /backup.

Usage:

See the docker-compose.yml example in this repo. This is a typical setup in a service stack

Variables

  • MONGO_HOST: the hostname or IP, default is mongo
  • MONGO_PORT: the port number, default is 27017
  • MONGO_USER: the username, default is admin
  • MONGO_PASS: the password, default is empty
  • CRON_TIME: the interval of cron job to run backup 0 0 * * * by default, which is every day at 00:00
  • MAX_BACKUPS: the number of backups to keep. When reaching the limit, the old backup will be discarded. No limit by default
  • INIT_BACKUP: if set, create a backup when the container starts
  • INIT_RESTORE_LATEST: if set, restore the latest database backup
  • MONGO_AUTH_DB: authenticationDatabase used

Restore from a backup

To restore database from a certain backup, simply run:

docker exec fradelg/mongo-backup /restore.sh /backup/2017.08.06.17.19

About

Monog backup tools based on official mongo image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 86.3%
  • Dockerfile 13.7%