Skip to content

Instantly share code, notes, and snippets.

@vemuruadi
Last active November 18, 2019 23:09
Show Gist options
  • Save vemuruadi/e731d8095552497a9bd1b2a3ab051422 to your computer and use it in GitHub Desktop.
Save vemuruadi/e731d8095552497a9bd1b2a3ab051422 to your computer and use it in GitHub Desktop.
docker container id - 8c37a950839a
# 1. Copy Mongo dump to container folder
(Local System)$ docker cp dump/reaction 8c37a950839a:/var/backups/reaction
# 2. Connect to mongodb docker container
(Local System)$ docker exec -it 8c37a950839a /bin/bash
# 3. Check if backup is copied to docker container
(Container)$ ls var/backups/reaction
# 4. Drop Database
(Container)$ mongo
(Container->Mongo)$ show dbs -> use reaction -> db.dropDatabase() -> exit
(Container)$
# 5. Restore dump inside container to Mongodb from the container shell
(Container)$ mongorestore -d reaction var/backups/db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment