Connecting Robo 3T to Docker MongoDB container

This is document assuming you have already up your mongo docker container and its working fine on your docker container host machine.

Let suppose your docker container host machine ip address is x.x.x.1.

You can check your docker container up and running by command.

docker ps -a

Process to connect docker container.

Normally we connect mongo db on over local machine simply localhost:27017 or IP:27017 normal machine, where mongo db is running as background service.

What is the issue or problem when we want to connect mongo db docker container with robo 3T?.

The main problem and confusion is, container’s internal ip address and external ip address.

The internal IP is your container’s address in the docker network, which is isolated from you host network. When you do the docker inspect command, you grabbed the container’s IP on the docker network.

“NetworkSettings” -> “Networks” -> “IPAddress”.

External ip address is machine ip address, in our case it is x.x.x.1.

Use SSH Tunnel to connect mongo container.

We would use ssh tunnel to connect mongo db container from robo 3T. Here is steps to establish connection.

  1. Use your ssh credentials to create ssh connection.

2. Put your admin user credentials to authentication for mongo db.

3. Use your container’s internal ip address to connect mongo database, that you found in docker inspect <container-id> command.

4. That’s it, hit the test button and cheers.

Connecting Robo 3T to Docker MongoDB container
Show Buttons
Hide Buttons