MongoError: failed to connect to server [127. 0.0.1:27017]

i tried to run the deploye the nodejs application with mongo db using docker on windows. here i create a container my nodejs application and also mongo db but i got the following error "MongoError: failed to connect to server [127. 0.0.1:27017] "

if you have two containers, they usually have different ip’s. so if your nodejs container talks about 127.0.0.1 then this is another 127.0.0.1 than the mongo db is listening on.
Try to change your url within the nodejs to mongo:27017 (or mongodb, depends how you called it).

i created nodejs and mongodb two container how can communicate these two. these container has two directive in windows machine.

if you start nodejs, you need to link it to the previously started mongodb container.
try to have a look at the --link option for 'docker run. I guess you are starting them by hand. Otherwise you could try out to define your service within adocker-compose`-File. This will assist you with orchestration.