Answer the question
In order to leave comments, you need to log in
How to execute mongorestore in docker?
Good days.
I posted a meteor project on vps using mupx (docker runtime), now I need to restore the backup made on local to this container in the mongodb database.
The dump.zip file, I have already uploaded to the server using this command: scp dump.zip [email protected]***.112.***.112:/home/chklist
Then I unpacked the archive (unzip), and I transferred this directory to the container, in this way: docker cp /home/chklist/dump chklist/~
And now I'm trying to restore it like this: docker exec mongodb mongorestore dump --db chklist
I get an error:
Failed: can't create ActualPath object from path local/dump: stat local/dump: no such file or directory
docker cp /home/chklist/dump mongodb:~
Answer the question
In order to leave comments, you need to log in
Connect with bash, go to the folder where the dump folder is located and run mongorestore
docker exec -she mongodb bash
Make a dump
docker exec <mongodb container> sh -c 'mongodump --archive' > db.dump
docker exec -i <mongodb container> sh -c 'mongorestore --archive' < db.dump
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question