Cannot connect to couchbase on a different port

I am using this example and it runs fine. But if I spin up another couchbase server like

docker run -d --name db2 -p 8095-8098:8091-8094 -p 11211:11210 couchbase

The output would be that I would have 2 couchbase clusters with 1 node each 172.17.0.2 and 172.17.0.3 respectively.

According to the example if I dont mention any node address then it connects to the couchbase on 8091 and then business as usual. But I cannot connect to the second couchbase cluster.

            using (var cluster = new Cluster(new ClientConfiguration 
            {
                Servers = new List<Uri> 
                {
                    new Uri("http://127.0.0.1:8095")
                }                
            }))

How do I connect to both first and second couchbase clusters from my .NET app?

To my knowledge, Couchbase doesn’t support mapping to non-standard port numbers the way you are doing it. To make this work, I’d advise dropping the localhost port mappings altogether and accessing via the private IP within the Docker network.

However, on Windows this is typically difficult to get running because you need to NAT from localhost to the Docker VM, and from there to the internal Docker network. I have done this before: https://github.com/docker/for-win/issues/221#issuecomment-260065547. However, I have also seen that create an infinite packet forward loop that used up an entire CPU core on my machine in vpnkit.