I’m trying to install Charts on a Ubuntu 20.4 GCP instance with port 80 and 443 open. I’ve installed the metadata MongoDB on the same instance, binding ip to 0.0.0.0 and enabling authentication. Connecting to the metadata DB with the root DB user and performing “show dbs” using “mongo” works locally.
However, I’m currently unable to connect to the metadata DB using the test script:
docker run --rm quay.io/mongodb/charts:19.12.2 charts-cli test-connection ‘mongodb://user:email@example.com:27017/?authSource=admin’
This is the error response. I’ve spent 1-2 days and can’t get Charts to work
Unable to connect to MongoDB using the specified URI.
The following error was returned while attempting to connect:
MongoNetworkError: failed to connect to server [127.17.0.1:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.17.0.1:27017]
The result from pinging the specified server “127.17.0.1” from within the container is:
PING 127.17.0.1 (127.17.0.1) 56(84) bytes of data.
64 bytes from 127.17.0.1: icmp_seq=1 ttl=64 time=0.026 ms
— 127.17.0.1 ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.026/0.026/0.026/0.000 ms
Possible reasons for this error include:
- The hostname you specified is incorrect
- MongoDB is not running on the server
- The Docker container was unable to resolve the hostname specified in the URI
- The Docker container was unable to resolve the hostnames of replica set members as configured on the server
Things you can try:
- Check that the hostname is correct and MongoDB is running on the host.
- Try connecting using the host IP address instead of the hostname. This may require changes to your mongod or replica set configuration
- Configure Docker to use a custom DNS server that can resolve the hostname. For example, if your DNS server is 188.8.131.52:
- As a parameter to this “docker run” command, add the following after -it: --dns=184.108.40.206
- After successfully validating the connection, in the Docker Compose file for launching Charts, add this line as a child of charts: dns: 220.127.116.11
- Configure Docker with explicit mappings between hostnames and IP addresses. For example if the host “myhost1” is reachable at 18.104.22.168 and “myhost2” is reachable at 22.214.171.124:
- As a parameter to this “docker run” command, add the following after -it: --add-host myhost1:126.96.36.199 --add-host myhost2:188.8.131.52
- After successfully validating the connection, in the Docker Compose file for launching Charts, add these lines as a child of charts:
Any idea would be super appreciated :’(