Docker container with cronjob to run mongodump for MongoDB 5.0. Based on Ubuntu 20.04
1.7K
Read this Blogpost for a more detailed explaination on how to use the container.
docker built -t mymongodump
version: '3.1'
services:
mongo:
image: mongo:5.0
restart: always
volumes:
- ./mongo_data:/data/db
mongo-backup:
image: tarator/mongodump:latest
restart: always
links:
- mongo
depends_on:
- mongo
volumes:
- ./mongo_backup:/backup:rw
environment:
- MONGO_HOST=mongo
- MONGO_PORT=27017
- BACKUP_CRON_TIME=05 18 * * *
- KEEP_DAYS=14
This creates a Dump of the complete MongoDB everyday at 18:05 (HeadsUp: Container-Time is UTC) in the directory ./mongo_backup. The filename of the backup looks like this: mongodump_2021-11-30_21.35.55.gz
mongorestore --host localhost:27017 --gzip --archive=mongodump_2021-11-30_21.35.55.gz
https://gitlab.projecttac.com/tarator/mongodump
Feel free to use and improve.
Content type
Image
Digest
sha256:31eaedd9d…
Size
124.2 MB
Last updated
over 1 year ago
docker pull tarator/mongodump