Connect to MongoDB query router for Sharding on a docker container running on windows10


This is a follow up of my previous question. Alex Blex’s solution for connecting to the config servers works great. But I am facing the same issue while connecting to the MongoDB Query router.

Below is the command I am using to create the mongos server

docker run -d -p 40001:27017 -v C:/mongodata/data/db --name QR mongo mongos --configdb rs1/,, --bind_ip --port 27017

But I get the below error on executing docker exec -it QR mongo -port 27017:-

connecting to:
Error: couldn’t connect to server, connection attempt
failed: SocketException: Error connecting to :: caused
by :: No connection could be ma de because the target machine actively
refused it. : [email protected]/mongo/shell/mongo.js:374:17 @(connect):2:6
exception: connect failed exiting with code 1

Below is the replication configuration details for the Config Servers –

config = {
          "_id": "rs1",
          "configsvr": true,
                "_id": 0,
                "host": "6ed1d953f979:27019"
                "_id": 1,
                "host": "086f0ef5c955:27019"
                "_id": 2,
                "host": "391c9c07b341:27019"

Here is the container ID and IP address

Server      IP Address      Container ID 
asiaCS   6ed1d953f979
europeCS    086f0ef5c955
americaCS   391c9c07b341

I am not sure if I am even configuring the mongos properly.

Source: Docker Questions

Categorised as docker, mongodb, windows-10 Tagged , ,


Leave a Reply

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us