Search code examples
mongodbubuntudockermongorestore

Failed: mongorestore target 'dump' invalid: stat dump: no such file or directory


I'm trying to mongorestore a mongodump-ed set of .bson files to a mongo database that lives within docker, on an Ubuntu instance to which I have SSH access only.

I have a "db" folder, and within that I ran the "mongorestore" command which created the following structure:

├── db
│   ├── dump
│   │   └── <dump-name>

I now want to run the following command from the db directory:

docker exec -it mongo_db_container mongorestore -d collection_name dump

but I am getting the following error:

Failed: mongorestore target 'dump' invalid: stat dump: no such file or directory

I can "ls" and see that the folder and that structure exists, and that the .bson files live within the leaf-level folder. I've run the same set of commands locally on my Windows machine, and all worked correctly. Is it possible it's some kind of permissions issue in Ubuntu? I've "sudo"-ed the command, but same issue.

Thanks for any help you can provide!


Solution

  • Try following steps to debug further.

    #>docker exec -it mongo_db_container sh
    

    Once you have a terminal inside the container then try executing the command

    $>mongorestore -d collection_name dump
    

    Let me know and see, if directories are in well structure here inside container and current user has permission to execute & write content on that directory.