K
K
Konstantin Chuykov2016-04-23 00:07:20
MongoDB
Konstantin Chuykov, 2016-04-23 00:07:20

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

Then I saw that it turns out that mupx makes two containers, one with the name of the project, the other mongodb, and I copied the dump folder to another container:
docker cp /home/chklist/dump mongodb:~
Tried running the mongorestore command again, and got the same error.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lega, 2016-04-23
@chuikoffru

Connect with bash, go to the folder where the dump folder is located and run mongorestore
docker exec -she mongodb bash

A
Artem Besedin, 2020-11-19
@speker

Make a dump

docker exec <mongodb container> sh -c 'mongodump --archive' > db.dump

Restore dump
docker exec -i <mongodb container> sh -c 'mongorestore --archive' < db.dump

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question