user6103114
user6103114

Reputation:

Hyperledger Fabric peer container cannot communicate with couchdb container

I am trying to configure hyperledger fabric network. I run three zookeepers, three kafkas, three orderers and a couchdb. They are docker containers and work well. All containers are in the same docker network called ibknet. After that, I run peer container but it has a problem to detect couchdb container while its starting. Here is my command to run peer container.

docker run -d --name main.stock.ibk.com --hostname main.stock.ibk.com \ -p 7051:7051 \ -p 7053:7053 \ -e CORE_LEDGER_STATE_STATEDATABASE=CouchDB \ -e CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984 \ --network ibknet hyperledger/fabric-peer:x86_64-1.0.4

Here is the list of running docker containers before executing the command above.

0b49e1d9e135        hyperledger/fabric-couchdb:x86_64-1.0.4     "tini -- /docker-e..."   28 minutes ago      Up 28 minutes               4369/tcp, 5984/tcp, 9100/tcp   couchdb0
592e81a721f1        hyperledger/fabric-orderer:x86_64-1.0.4     "orderer"                28 minutes ago      Up 28 minutes               0.0.0.0:9050->7050/tcp         orderer2
5a0d0f05770d        hyperledger/fabric-orderer:x86_64-1.0.4     "orderer"                28 minutes ago      Up 28 minutes               0.0.0.0:8050->7050/tcp         orderer1
681894ae835a        hyperledger/fabric-orderer:x86_64-1.0.4     "orderer"                28 minutes ago      Up 28 minutes               0.0.0.0:7050->7050/tcp         orderer0
2c1910c3e293        hyperledger/fabric-kafka:x86_64-1.0.4       "/docker-entrypoin..."   28 minutes ago      Up 28 minutes               9092-9093/tcp                  kafka2
b27ff82abd3d        hyperledger/fabric-kafka:x86_64-1.0.4       "/docker-entrypoin..."   29 minutes ago      Up 28 minutes               9092-9093/tcp                  kafka1
2f84d000c2d6        hyperledger/fabric-kafka:x86_64-1.0.4       "/docker-entrypoin..."   29 minutes ago      Up 28 minutes               9092-9093/tcp                  kafka0
25438ef57579        hyperledger/fabric-zookeeper:x86_64-1.0.4   "/docker-entrypoin..."   29 minutes ago      Up 29 minutes               2181/tcp, 2888/tcp, 3888/tcp   zookeeper2
c01262ae099e        hyperledger/fabric-zookeeper:x86_64-1.0.4   "/docker-entrypoin..."   29 minutes ago      Up 29 minutes               2181/tcp, 2888/tcp, 3888/tcp   zookeeper1
f95e92b10b25        hyperledger/fabric-zookeeper:x86_64-1.0.4   "/docker-entrypoin..."   29 minutes ago      Up 29 minutes               2181/tcp, 2888/tcp, 3888/tcp   zookeeper0

And I got this error messages in docker logs when I run the peer container.

2017-12-01 07:26:34.238 UTC [ledgermgmt] initialize -> INFO 002 Initializing ledger mgmt
2017-12-01 07:26:34.238 UTC [kvledger] NewProvider -> INFO 003 Initializing ledger provider
2017-12-01 07:26:34.624 UTC [couchdb] handleRequest -> WARN 004 Retrying couchdb request in 125ms. Attempt:1  Error:Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused
2017-12-01 07:26:34.987 UTC [couchdb] handleRequest -> WARN 005 Retrying couchdb request in 250ms. Attempt:2  Error:Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused
2017-12-01 07:26:35.533 UTC [couchdb] handleRequest -> WARN 006 Retrying couchdb request in 500ms. Attempt:3  Error:Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused
2017-12-01 07:26:36.279 UTC [couchdb] handleRequest -> WARN 007 Retrying couchdb request in 1s. Attempt:4  Error:Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused
2017-12-01 07:26:37.617 UTC [couchdb] handleRequest -> WARN 008 Retrying couchdb request in 2s. Attempt:5  Error:Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused
2017-12-01 07:26:39.819 UTC [couchdb] handleRequest -> WARN 009 Retrying couchdb request in 4s. Attempt:6  Error:Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused
2017-12-01 07:26:44.019 UTC [couchdb] handleRequest -> WARN 00a Retrying couchdb request in 8s. Attempt:7  Error:Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused
2017-12-01 07:26:52.279 UTC [couchdb] handleRequest -> WARN 00b Retrying couchdb request in 16s. Attempt:8  Error:Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused
2017-12-01 07:27:08.515 UTC [couchdb] handleRequest -> WARN 00c Retrying couchdb request in 32s. Attempt:9  Error:Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused
2017-12-01 07:27:40.730 UTC [couchdb] handleRequest -> WARN 00d Retrying couchdb request in 1m4s. Attempt:10  Error:Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused
panic: Error in instantiating ledger provider: Unable to connect to CouchDB, check the hostname and port: Get http://couchdb0:5984/: dial tcp 75.126.101.240:5984: getsockopt: connection refused

What do I miss? And I have no idea that where 75.126.101.240 address is from.

Actually, I could succeed in running it with --add-host option by mentioning exactly ip. But I don't think that is a proper way because ip is changing whenever I start docker servers.

Please help this issue. Thanks.

Upvotes: 4

Views: 2228

Answers (1)

Gari Singh
Gari Singh

Reputation: 12013

Try adding : "--dns-search ." to the docker run command. The resolver on your host system is likely configured to append / search a domain for unknown hosts. "--dns-search ." should force resolution only via the embedded Docker DNS

Upvotes: 2

Related Questions