Skip to content

Instantly share code, notes, and snippets.

@ipedrazas
Created August 27, 2014 00:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ipedrazas/4ae3b909af660402bcf1 to your computer and use it in GitHub Desktop.
Save ipedrazas/4ae3b909af660402bcf1 to your computer and use it in GitHub Desktop.
MongoDump with Docker
#!/bin/bash
set -e
export LC_ALL=C
TS=$( date --utc '+%Y-%m-%dT%H:%M:%SZ' )
BACKUP_DIR="/data/backup/${TS}"
docker run -it --rm --link mongodb:mongodb -v /data/mongodb:/data dockerfile/mongodb bash -c 'mongodump --out '${BACKUP_DIR}' --host $MONGODB_PORT_27017_TCP_ADDR'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment