Sunday, 23 April 2017
connect Robomongo to mongoDB docker container
If you are running mongo docker container on your PC and you want to use your robomongo from your host machine to connect your the mongo container, then you just expose your mongo port.
docker run -d -p 27017:27017 --name mongo mongo
then you can use robomongo to connect to it by localhost 27017.
Note run mongo container with "--rm" is a very bad idea. because it will remove all your data everytime. that because According to mongo official document, you have two ways to manage your files: let mongo container to manage it inset of the container. or use volume. the first one is the default settings , so if you --rm the container will remove itself after it stops, so all your data files are gone.
To connect to a mongo container which is running no another machine.
But I still not able to install SSH service into mongo container. Actually, can install but not able to login by root/password). I have tried to install SSH service into a ubuntu and successfully logged in. so i suspect the official mongo image doesn't have SSH needed components.