Why won’t Compass connect to my MongoDB Docker Cluster?

0
5
Asked By RandomHiker42 On

I'm trying to set up a MongoDB cluster using Docker Compose, but I can't get Compass to connect. Here's my Docker Compose configuration: I've got three MongoDB instances (mongo1, mongo2, mongo3), all set up with replica set configurations. I'm exposing the ports and running a script to initiate the replica set. But when I try to connect with Compass, it seems like it's not working. Any ideas on what configuration I need to use?

2 Answers

Answered By TechSavvyJoe On

What connection string are you using in Compass? Make sure to specify the correct URI, which should look something like `mongodb://localhost:27017`. If you're connecting from the host, this should work as expected.

Answered By CodeNinja88 On

I had a similar issue. I found that I needed to update my `/etc/hosts` file to make it work, but that's not ideal. I'm also trying to build a seamless development environment across Windows, Linux, and macOS without having to do system-specific tweaks. Maybe there's another way around it? I’d love your suggestions!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.