Docker image that provides capability to perform native Mongodb import/export and database dump
1.8K
Docker image that provides capability :
MONGO_HOST the host/ip of your mongodb database
MONGO_PORT the port number of your mongodb database
MONGO_DB_NAME the database name
MONGO_COLLECTION_NAME the database collection to work on, according to the MONGO_DB_NAME provided
MONGO_BACKUP_FILENAME the name of the generated file
CRON_SCHEDULE the interval of cron job to run mongodump
In order to specify the willing action, you must override the default docker command. The running container requires the following environments variables :
Require for every jobs:
Require for Export :
Require for Import:
Require for Dump:
This container is designed to perform operations on a running mongoDB instance.
To import json data, this container assumed that the filename is import.json.
If YOUR_PATH/import.json is the location of the import file :
docker run \
-v YOUR_PATH/:/tmp/mongodb/ \
-e MONGO_HOST=your_host_value \
-e MONGO_PORT=your_port_value \
-e MONGO_DB_NAME=your_db_name \
-e MONGO_COLLECTION_NAME=your_collection_name \
bwnyasse/docker-mongodb-worker \
/start.sh -i
With cron
docker run \
-e MONGO_HOST=your_host_value \
-e MONGO_PORT=your_port_value \
-e MONGO_DB_NAME=your_db_name \
-e MONGO_COLLECTION_NAME=your_collection_name \
-e CRON_SCHEDULE=your_cron_schedule \
-e MONGO_BACKUP_FILENAME=your_backup_filename_without_extension \
bwnyasse/docker-mongodb-worker \
/start.sh -e cron
Without cron ( direct export)
docker run \
-e MONGO_HOST=your_host_value \
-e MONGO_PORT=your_port_value \
-e MONGO_DB_NAME=your_db_name \
-e MONGO_COLLECTION_NAME=your_collection_name \
-e MONGO_BACKUP_FILENAME=your_backup_filename_without_extension \
bwnyasse/docker-mongodb-worker \
/start.sh -e no-cron
With cron
docker run \
-e MONGO_HOST=your_host_value \
-e MONGO_PORT=your_port_value \
-e CRON_SCHEDULE=your_cron_schedule \
-e MONGO_BACKUP_FILENAME=your_backup_filename_without_extension \
bwnyasse/docker-mongodb-worker \
/start.sh -d cron
Without cron ( direct dump)
docker run \
-e MONGO_HOST=your_host_value \
-e MONGO_PORT=your_port_value \
-e MONGO_BACKUP_FILENAME=your_backup_filename_without_extension \
bwnyasse/docker-mongodb-worker \
/start.sh -d no-cron
For export and dump ,the backup data will be hosted into /backup/
Easy to use with docker-compose , go into the example
Content type
Image
Digest
Size
123.3 MB
Last updated
about 10 years ago
docker pull bwnyasse/docker-mongodb-worker