Search code examples
mongodbdockerdocker-composemongo-express

mongo-express connection problem with docker


I'm trying to set up docker running mongodb with docker-express and deployd.

Mongodb seems to be working just fine but mongo-express keeps throwing me the same error. I tried almost everything with the parameter as I am quite sure that there's something wrong with the mongo-express configuration.

Here's my docker-compose.yml configuration for mongo and mongo-express:

enter image description here

The purple boxes contain the same credentials.

Here's a screenshot of the docker logs for the mongo-express container.

enter image description here

When I checked other similar issues, most of those where solved by modifying the MONGODB_URL, but in this case the URL seems just fine to me. Let me know if I'm wrong.


Solution

  • The containers didn't use the same docker network and the DNS record used for connecting to the mongo server was using the container name instead of the service name.

    After checking these misconfigurations the issue was resolved