Skip to content

Instantly share code, notes, and snippets.

@RolandWarburton
Created October 6, 2021 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RolandWarburton/8cab01c073e136e973f69de6abaf0729 to your computer and use it in GitHub Desktop.
Save RolandWarburton/8cab01c073e136e973f69de6abaf0729 to your computer and use it in GitHub Desktop.
backup mongo
# change /home/roland/backup to backup location on host
# change the username, password, and ip
# change the authSource
docker run \
-it --name "mongodump" --rm \
-v /home/roland/backup:/data \
-w /data/ \
mongo:4.0 \
mongodump \
--uri="mongodb://username:password@192.168.0.100:27017/?authSource=dbname" \
--out="/data/backup"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment