-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to connect to my MongoDB Atlas cluster #119
Comments
Could this be a dns issue? Can you test if the message is different if you specify the server by IP address? Or you can ping from the container to make sure dns is working. |
Not sure how to get the server IP address. I just tested:
|
And for your information, if instead I do:
It's apparently working successfully:
|
If the ping also fails that would confirm that the domain name cannot be resolved from the container. You can try to ping it from the host to get the ip address, or test if other dns servers work. $ docker run -it --rm mongo-express:latest ping -c 1 google.ca
+ '[' ping '!=' mongo-express ']'
+ exec ping -c 1 google.ca
PING google.ca (142.251.33.163): 56 data bytes
64 bytes from 142.251.33.163: seq=0 ttl=62 time=41.486 ms
--- google.ca ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 41.486/41.486/41.486 ms $ docker run -it --rm mongo-express:latest ping -c 1 this.domain.does.not.resolve
+ '[' ping '!=' mongo-express ']'
+ exec ping -c 1 this.domain.does.not.resolve
ping: bad address 'this.domain.does.not.resolve' If ping also fails on your host machine, you might have to flush dns somewhere, maybe your router? maybe a local dns cache? You can test on a web tool like https://dns-lookup.jvns.ca/ or https://dns.google/ to see if it resolves. If it also doesn't resolve on one of those tools, then I would think the issue needs to be on mongodb.net's side. |
It looks like some ISPs will block SRV dns requests, you might want to try using a public dns server? To test this, try
or
If those don't work you might need to use a public dns resolver like 1.1.1.1 |
Oh, I didn't think about svc records, our health check only supports A records I think. We have another bug open for that. You could get around this bug by just changing the entrypoint to services:
mongo-express:
command: node app
image: mongo-express
restart: always
environment:
- ME_CONFIG_MONGODB_URL=mongodb+srv://<username-redacted>:<password-redacted>@<server-redacted>.mongodb.net/?retryWrites=true&w=majority
ports:
- "8081:8081" |
Interesting with
|
getting same error with atlas url |
add the below to the environment |
I'm doing:
But as soon as I hit the endpoint, if I look at the logs of my running container, I'm getting:
Am I missing anything?
The text was updated successfully, but these errors were encountered: