Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
docker container id - 8c37a950839a
# Make sure that the `/var/backups` folder is clean inside the container
# 1. Copy Mongo dump to container folder
(Local System)$ docker cp dump/reaction 8c37a950839a:/var/backups
# 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 shell)$ show dbs
use reaction
db.dropDatabase()
exit
(Container)$
# 5. Restore dump inside container to Mongodb from the container shell root folder
(Container)$ mongorestore -d reaction var/backups/reaction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment