mongodump as an ultra-small Docker image.
395
An ultra-small Docker image containing MongoDB's mongodump tool. It enables seamless creation of MongoDB backups without the need to install MongoDB or its dependencies on your system.
mongodump and its dependencies.mongodump without installing MongoDB or its dependencies on your system.mongodump in your backup scripts.To create a backup of your MongoDB database, run the following command:
docker run --rm -v /my/backup/folder:/backup chaos/mongo-backup:latest \
--uri mongodb://localhost:27017 \
--db MyDatabase \
--gzip \
--archive=/backup/mybackup.gz
Explanation:
--rm: Automatically remove the container when it exits.-v /my/backup/folder:/backup: Mounts the local folder /my/backup/folder/ to the container's /backup directory.chaos/mongo-backup:latest: Use the latest version of the chaos/mongo-backup image.--uri mongodb://localhost:27017: The MongoDB connection string. You can also use mongodb://username:password@localhost:27017.--db MyDatabase: The name of the database you want to dump.--gzip: Compress the output using gzip.--archive=/backup/mybackup.gz: Store the backup in a single file named mybackup.gz in the container's /backup directory.You can also specify the --out option instead of --archive to create a directory containing all collections as separate dumps.
See the official MongoDB documentation for more options.
When using this image on the command line or in your backup scripts, especially in multi-user environments, be cautious about exposing sensitive information such as the passwords.
The recommended approach is to provide a YAML configuration for mongodump containing the connection string:
uri: mongodb://username:password@localhost:27017
Then, run the following command:
docker run --rm -v /my/backup/folder:/backup \
-v /path/to/config.yaml:/config.yaml \
chaos/mongo-backup:latest \
--db MyDatabase \
--gzip \
--archive=/backup/mybackup.gz
MIT License - see LICENSE for more information.
Content type
Image
Digest
sha256:d3c0aa627…
Size
20.4 MB
Last updated
over 1 year ago
docker pull chaos/mongo-backup