Compass can't connect to mongodb running in docker

I’m running mongodb instance in docker:
docker run --name mongodb -d -p 27017:27017 mongo

When I try to connect to the instance from Compass v: 1.23.0:

Compass fail to connect with error connection <monitor> to closed. but I can connect to the db from my nodejs running on host.

Please help.

1 Like

Have you whitelisted your IP?
or could be some firewall issues
Please check this link.Different fixes given in it

1 Like

That’s unexpected, and I can’t reproduce it. If I run

docker run --name mongodb -d -p 27017:27017 mongo

in my terminal Compass connects with no issues. Can I see a screenshot of the Compass connection screen?


A post was split to a new topic: Can’t connect after upgrading to Compass 1.24.1