Failure on Cluster.WaitUntilReady

When I try connecting to the couchbase server (installed directly on mac, following - Install Couchbase Server on macOS | Couchbase Docs) it works fine. But When I set up the couchbase server (3 containers) using docker (following - Install Couchbase Server Using Docker | Couchbase Docs) the waitUntilReady is failing. I want to use transactions using the go SDK (2.4) but it needs the replica of the bucket to be > 1 and for that, we need a couchbase cluster. Any idea what can I do about this?

var err error
Cluster, err = gocb.Connect(host, gocb.ClusterOptions{
	Username: username,
	Password: password})
if err != nil {
	return err
}

err = Cluster.WaitUntilReady(100*time.Second, nil)

This is the error -

unambiguous timeout | {"InnerError":{"InnerError":{"InnerError":{},"Message":"unambiguous timeout"}},"OperationID":"WaitUntilReady","Opaque":"","TimeObserved":10003750250,"RetryReasons":["NOT_READY"],"RetryAttempts":6,"LastDispatchedTo":"","LastDispatchedFrom":"","LastConnectionID":""}

Hi!
This is usually caused either by an invalid host or login/password combination. Could you post the host value you’re using to connect to the cluster? (feel free to replace any public address with a random one, but I need to see if you’re specifying a protocol and/or port in that string).

You also can try troubleshooting the connection using our SDK doctor, it is usually very helpful in cases like this: SDK Doctor | Couchbase Docs

Thank you for choosing Couchbase and please let me know if you have any additional questions.

Hi Chedim,
Thanks for your reply, host = “localhost”. I am trying on my local machine using docker. I tried running SDK doctor. (./sdk-doctor-macos diagnose localhost/SCM -u Administrator -p admin@123)

Bootstrap host `localhost` is not using the canonical node hostname of `172.17.0.2`.  This is not neccessarily an error, but has been known to result in strange and challenging to diagnose errors when DNS entries are reconfigured.

So it looks like after finding the nodes it is then using 172.17.0.2, 172.17.0.3, 172.17.0.4 which are internal docker IPs in the docker network so it will fail to connect from the host.

12:44:36.373 INFO ▶ Failed to retreive cluster information (error: Get "http://172.17.0.2:8091/pools/default": context deadline exceeded (Client.Timeout exceeded while awaiting headers))
12:44:38.377 ERRO ▶ Failed to connect to Key Value service at `172.17.0.2:11210` (error: dial tcp 172.17.0.2:11210: i/o timeout)
12:44:40.378 ERRO ▶ Failed to connect to Management service at `172.17.0.2:8091` (error: Get "http://172.17.0.2:8091/": context deadline exceeded (Client.Timeout exceeded while awaiting headers))
...

I pushed my code into a docker container and It is working fine. It solves my issue :smiley: but is there a way I can connect to it from the host?