circuitBurn
circuitBurn

Reputation: 903

MongoDB & Docker: connections from Dockerized Mongo client to external server refused

I've got a mongod instance running on server A. Server B has a Dockerized container for our web app (apache, django, mongoengine). Server B's mongo client needs to connect to A's mongod instance. I can connect through the shell and pymongo without trouble from B to A but my Dockerized django app's connections are refused.

ConnectionError: Cannot connect to database test :
[Wed Mar 11 17:30:49.452307 2015] [:error] [pid 13:tid 140069001664256] [client <client ip>] [Errno 111] Connection refused

This is how I'm connecting using mongoengine:

register_connection(alias="test", name="test", host="mongodb://user:pwd@<server ip>:27017/test?ssl=true")
connect(db="test", alias="test")

And running the Docker container

docker run -d -p 443:443 -p 27017:27017 me/webapp

I've also set ip_forward to 1 as per the docs.

What am I missing?

Upvotes: 0

Views: 803

Answers (1)

circuitBurn
circuitBurn

Reputation: 903

As it turns out it had nothing to do with Docker or mongoengine (directly). Pymongo 2.7.2 does not support SCRAM-SHA-1 authentication. The solution is to install the 2.8 release candidate.

pip install git+git://github.com/mongodb/[email protected]

See the Jira ticket which was helpful and the pymongo blog post which ultimately provided me with a fix.

Upvotes: 0

Related Questions