Mongorestore to a Docker container
I recently launched a Meteor based application that runs in a Docker container on a server running coreOS. I have a container running the node application, and a container running MongoDB. (Find an example of my Dockerfile for Meteor apps here).
When I first launched the application, I needed to copy up a bunch of mongo collections to the mongo container that I had running. It took me a minute to figure out how to do it, so I thought I'd share it:
#1 SSH into your server
ssh email@example.com -L 10000:mongo-container-port:mongo-container-port
-L to forward a port on your machine (I picked 10000) to your mongo container.
mongorestore -h localhost:10000 --db exampledbname /path/to/mongodump
Run mongorestore on the port on your machine that's forwarded to the mongo container on your server.
That's it! It's pretty easy to do :)