Cannot connect to mongodb instance from docker: Connection refused
问题 I am using docker-compose to create a multi-container environment where I have one mongodb instance and two python applications. The problem is, the first application is able to establish a connection to mongodb whereas the second application fails with the following error: File "/usr/local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 377, in __init__ notification_1 | raise ConnectionFailure(str(e)) notification_1 | pymongo.errors.ConnectionFailure: [Errno -2] Name or service