ref: https://docs.docker.com/machine/get-started/
[Narrator] To get started with MongoDB, we first have to use Docker to download and run a container for it. Make sure that your Docker daemon is running. You can do that by simply clicking here on the Docker icon, and you see that Docker is running here. And then, open the terminal. And here, we type docker pull mongo. And this will pull down the MongoDB image from Docker Hub. Next, we start a new container by typing docker run --name. And we will call this container mongodb, and now we add some port configuration. I will explain it in a second. So, first I type it 37017, column 27017.
Basically it's always the same. But if you run into problems, please look into the documentation of Docker for your operating system. Now hit Return, and our MongoDB container is already running. We can test this by typing docker ps. And here we see this MongoDB container. It might happen that this container stops for some reason or you restart your system and Docker is not running anymore.
And I take the first result here. And I select Download Robo 3T, right here, download again.And as you see, there are versions for Windows and Linux as well. I download the Macintosh installer here and I run it. And I now I drag this icon into my Applications folder. So let's open it now. I simply select Search here and type robo 3t, and here we go.
Now we have to configure our connection to our database server. For that, I click on Create.And let's call it simply Local Mongodb. And for that, we connect to localhost and to our port 37017. Let's test that, and it works well.
So I can save this connection, and then I can double-click on it to open it. And on your left menubar, you should see some system tables already on your local database here. Now, MongoDB is already running on our system, and this was quite easy. Of course, for production deployment, setting of MongoDB is way more challenging. There are a lot of configuration options like security, storage engines, replications.
And you might even want to consider tweaking your filesystem and kernel settings to make MongoDB run smoothly under high load. For our sample project though, this setup will fully suffice.
Stop & start mongodb
docker start mongodb (or container id)
docker stop mongodb
then check docker ps
[it's gone]
connect to mongo for robo 3T
hostname: 192.168.99.100
port: 37017
robo 3t
mongo compass
https://forums.docker.com/t/how-to-use-localhost-instead-of-192-168-99-100/54098