I have created docker container for Couchbase. The service is up and running but with the following command,
couchbase-cli cluster-init -c $CB_SERVER_IPADDR:8091 --cluster-init-username=admin --cluster-init-password=couchbase --cluster-init-ramsize=2048
I get a server node in couchbase with the name as its internal IP address - 172.x.x.x. Then when i create bucket using the following command,
couchbase-cli bucket-create -c $CB_SERVER_IPADDR:8091 -u admin -p couchbase --bucket=heartbeat --bucket-type=couchbase --bucket-ramsize=500 --bucket-replica=0 --wait
buckets gets created. But when my web application which is in a different container, communicates with couchbase with the IP address of the docker host where the Couchbase server is running, i get the following error message
2014-08-05 21:49:00.106 INFO com.couchbase.client.CouchbaseConnection: Reconnecting due to exception on {QA sa=172.x.x.x/172.x.x.x:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0}
java.net.NoRouteToHostException: No route to host
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:485)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:322)
at com.couchbase.client.CouchbaseConnection.run(CouchbaseConnection.java:288)
I could see that my application is using the server node name which is the internal IP address to communicate with the couchbase and thus the error. Any help appreciated