Docker Containers not connected ... Need Help!

Visit here : docker problem

I have a NodeJS container and a MongoDB container both of which are firing up on running docker-compose up .

The problem arises because the Node app can't connect to the Mongo DB.

Please have a look at this link

Thank you for the help

Comments (2)

Ehsan Fazeli's photo

I think the problem you're facing is that the app tries to connect to the mongodb before it's up and running and it causes the app to shut down.

What you need to do is to retry connecting to the database when it's not responding and withhold your app's execution until the connection is established successfully.

Instinct's photo

JS Developer in Action

Thanks man!

I just figured that out