Created
June 4, 2018 17:57
-
-
Save cristianounix/23d0f2fd04938159423643f92afb5289 to your computer and use it in GitHub Desktop.
Restore mongo database in your container (named mongo)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -s "$1" ] | |
then | |
MONGO_STATUS=$(docker inspect -f {{.State.Running}} mongo) | |
if [ "$MONGO_STATUS" != "true" ] | |
then | |
echo "Mongo is not running" | |
exit 1 | |
fi | |
else | |
echo "Syntax: $0 <filename>" | |
exit 1 | |
fi | |
cat $1 | docker exec -i mongo mongorestore --drop --gzip --archive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment