3

I tried to run fabcar example from hyperledger-fabric tutorial https://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html.

when I run ./startFabric.sh I got the error :

    //Join peer0.org1.example.com to the channel.
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer0.org1.example.com peer channel join -b mychannel.block
2017-08-06 08:05:59.338 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-08-06 08:05:59.338 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-06 08:05:59.339 UTC [grpc] Printf -> DEBU 003 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.19.0.5:7051: getsockopt: connection refused"; Reconnecting to {peer0.org1.example.com:7051 <nil>}
2017-08-06 08:06:00.341 UTC [grpc] Printf -> DEBU 004 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.19.0.5:7051: getsockopt: connection refused"; Reconnecting to {peer0.org1.example.com:7051 <nil>}
2017-08-06 08:06:02.045 UTC [grpc] Printf -> DEBU 005 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.19.0.5:7051: getsockopt: connection refused"; Reconnecting to {peer0.org1.example.com:7051 <nil>}
*Error: Error getting endorser client channel: PER:404 - Error trying to connect to local peer*
/opt/gopath/src/github.com/hyperledger/fabric/peer/common/common.go:116 github.com/hyperledger/fabric/peer/common.GetEndorserClient
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:149 github.com/hyperledger/fabric/peer/channel.InitCmdFactory
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:138 github.com/hyperledger/fabric/peer/channel.join
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:42 github.com/hyperledger/fabric/peer/channel.joinCmd.func1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute
/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 main.main
/opt/go/src/runtime/proc.go:192 runtime.main
/opt/go/src/runtime/asm_amd64.s:2087 runtime.goexit
Caused by: context deadline exceeded
Usage:
  peer channel join [flags]

Flags:
  -b, --blockpath string   Path to file containing genesis block

Global Flags:
      --cafile string              Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --logging-level string       Default logging level and overrides, see core.yaml for full syntax
  -o, --orderer string             Ordering service endpoint
      --test.coverprofile string   Done (default "coverage.cov")
      --tls                        Use TLS when communicating with the orderer endpoint
  -v, --version                    Display current version of fabric peer server

when I type 'docker ps' it showed:

CONTAINER ID        IMAGE                                     COMMAND                  CREATED             STATUS              PORTS                                        NAMES
f1b62c64395c        hyperledger/fabric-orderer:x86_64-1.0.0   "orderer"                34 minutes ago      Up 34 minutes       0.0.0.0:7050->7050/tcp                       orderer.example.com
4ad55e4adab7        hyperledger/fabric-ca:x86_64-1.0.0        "sh -c 'fabric-ca-..."   34 minutes ago      Up 34 minutes       0.0.0.0:7054->7054/tcp                       ca.example.com
0d785602a2c8        hyperledger/fabric-couchdb:x86_64-1.0.0   "tini -- /docker-e..."   34 minutes ago      Up 34 minutes       4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp   couchdb

I check using port in peer0 : $docker ps -a | grep peer0

d2babceff4b9        hyperledger/fabric-peer:x86_64-1.0.0      "peer node start"        About an hour ago   Exited (2) About an hour ago                                                  peer0.org1.example.com
d327030ceb88        dev-peer0.org1.example.com-fabcar-1.0     "chaincode -peer.a..."   10 days ago         Exited (2) 10 days ago                                                        dev-peer0.org1.example.com-fabcar-1.0
c5a8910b63cd        dev-peer0.org1.example.com-mycc-1.0       "chaincode -peer.a..."   2 weeks ago         Exited (2) 2 weeks ago                                                        dev-peer0.org1.example.com-mycc-1.0
26bf51834f7c        dev-peer0.org2.example.com-mycc-1.0       "chaincode -peer.a..."   2 weeks ago         Exited (2) 2 weeks ago                                                        dev-peer0.org2.example.com-mycc-1.0
83f46b5b696b        hyperledger/fabric-peer                   "peer node start"        2 weeks ago         Exited (0) 2 weeks ago                                                        peer0.org2.example.com

Then, I check the logs in each container:

$docker logs d2babceff4b9 | tail -20

2017-08-06 08:05:48.428 UTC [nodeCmd] serve -> INFO 001 Starting peer:
 Version: 1.0.0
 Go version: go1.7.5
 OS/Arch: linux/amd64
 Chaincode:
  Base Image Version: 0.3.1
  Base Docker Namespace: hyperledger
  Base Docker Label: org.hyperledger.fabric
  Docker Namespace: hyperledger

2017-08-06 08:05:48.428 UTC [ledgermgmt] initialize -> INFO 002 Initializing ledger mgmt
2017-08-06 08:05:48.428 UTC [kvledger] NewProvider -> INFO 003 Initializing ledger provider
2017-08-06 08:05:48.428 UTC [kvledger.util] CreateDirIfMissing -> DEBU 004 CreateDirIfMissing [/var/hyperledger/production/ledgersData/ledgerProvider/]
2017-08-06 08:05:48.428 UTC [kvledger.util] logDirStatus -> DEBU 005 Before creating dir - [/var/hyperledger/production/ledgersData/ledgerProvider/] does not exist
2017-08-06 08:05:48.428 UTC [kvledger.util] logDirStatus -> DEBU 006 After creating dir - [/var/hyperledger/production/ledgersData/ledgerProvider/] exists
2017-08-06 08:05:48.535 UTC [kvledger.util] CreateDirIfMissing -> DEBU 007 CreateDirIfMissing [/var/hyperledger/production/ledgersData/chains/index/]
2017-08-06 08:05:48.535 UTC [kvledger.util] logDirStatus -> DEBU 008 Before creating dir - [/var/hyperledger/production/ledgersData/chains/index/] does not exist
2017-08-06 08:05:48.559 UTC [kvledger.util] logDirStatus -> DEBU 009 After creating dir - [/var/hyperledger/production/ledgersData/chains/index/] exists
2017-08-06 08:05:48.617 UTC [kvledger] NewProvider -> DEBU 00a Constructing CouchDB VersionedDBProvider
2017-08-06 08:05:48.618 UTC [statecouchdb] NewVersionedDBProvider -> DEBU 00b constructing CouchDB VersionedDBProvider
2017-08-06 08:05:48.619 UTC [couchdb] CreateConnectionDefinition -> DEBU 00c Entering CreateConnectionDefinition()
2017-08-06 08:05:48.619 UTC [couchdb] CreateConnectionDefinition -> DEBU 00d Created database configuration  URL=[http://couchdb:5984]
2017-08-06 08:05:48.619 UTC [couchdb] CreateConnectionDefinition -> DEBU 00e Exiting CreateConnectionDefinition()
2017-08-06 08:05:48.619 UTC [couchdb] VerifyCouchConfig -> DEBU 00f Entering VerifyCouchConfig()
2017-08-06 08:05:48.619 UTC [couchdb] handleRequest -> DEBU 010 Entering handleRequest()  method=GET  url=http://couchdb:5984/
2017-08-06 08:05:48.632 UTC [couchdb] handleRequest -> DEBU 011 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:06:23.633 UTC [couchdb] handleRequest -> WARN 012 Retrying couchdb request in 125ms. Attempt:1  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:06:23.758 UTC [couchdb] handleRequest -> DEBU 013 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:06:58.759 UTC [couchdb] handleRequest -> WARN 014 Retrying couchdb request in 250ms. Attempt:2  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:06:59.010 UTC [couchdb] handleRequest -> DEBU 015 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:07:34.010 UTC [couchdb] handleRequest -> WARN 016 Retrying couchdb request in 500ms. Attempt:3  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:07:34.511 UTC [couchdb] handleRequest -> DEBU 017 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:08:09.512 UTC [couchdb] handleRequest -> WARN 018 Retrying couchdb request in 1s. Attempt:4  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:08:10.513 UTC [couchdb] handleRequest -> DEBU 019 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:08:45.513 UTC [couchdb] handleRequest -> WARN 01a Retrying couchdb request in 2s. Attempt:5  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:08:47.514 UTC [couchdb] handleRequest -> DEBU 01b HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:09:22.515 UTC [couchdb] handleRequest -> WARN 01c Retrying couchdb request in 4s. Attempt:6  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:09:26.516 UTC [couchdb] handleRequest -> DEBU 01d HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:10:01.517 UTC [couchdb] handleRequest -> WARN 01e Retrying couchdb request in 8s. Attempt:7  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:10:09.518 UTC [couchdb] handleRequest -> DEBU 01f HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:10:44.518 UTC [couchdb] handleRequest -> WARN 020 Retrying couchdb request in 16s. Attempt:8  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:11:00.519 UTC [couchdb] handleRequest -> DEBU 021 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:11:35.520 UTC [couchdb] handleRequest -> WARN 022 Retrying couchdb request in 32s. Attempt:9  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:12:07.521 UTC [couchdb] handleRequest -> DEBU 023 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 08:12:42.522 UTC [couchdb] handleRequest -> WARN 024 Retrying couchdb request in 1m4s. Attempt:10  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 08:13:46.522 UTC [couchdb] VerifyCouchConfig -> DEBU 025 Exiting VerifyCouchConfig()
panic: Error in instantiating ledger provider: Unable to connect to CouchDB, check the hostname and port: Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

goroutine 1 [running]:
panic(0xc917e0, 0xc42025a2c0)
    /opt/go/src/runtime/panic.go:500 +0x1a1
github.com/hyperledger/fabric/core/ledger/ledgermgmt.initialize()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:61 +0x2fe
github.com/hyperledger/fabric/core/ledger/ledgermgmt.Initialize.func1()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:49 +0x14
sync.(*Once).Do(0x143e768, 0xe291b0)
    /opt/go/src/sync/once.go:44 +0xdb
github.com/hyperledger/fabric/core/ledger/ledgermgmt.Initialize()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:50 +0x39
github.com/hyperledger/fabric/peer/node.serve(0x143e6a8, 0x0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:88 +0x113
github.com/hyperledger/fabric/peer/node.glob..func1(0x13e5260, 0x143e6a8, 0x0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:75 +0x3f
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute(0x13e5260, 0x143e6a8, 0x0, 0x0, 0x13e5260, 0x143e6a8)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 +0x234
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x13e58c0, 0xf, 0xc420012035, 0x7)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 +0x367
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute(0x13e58c0, 0x1a, 0xc420012035)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 +0x2b
main.main()
    /opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 +0x54e

docker logs d327030ceb88 | tail -20

2017-07-27 02:46:32.714 UTC [bccsp] initBCCSP -> DEBU 001 Initialize BCCSP [SW]
i is  0
Added {Toyota Prius blue Tomoko}
i is  1
Added {Ford Mustang red Brad}
i is  2
Added {Hyundai Tucson green Jin Soo}
i is  3
Added {Volkswagen Passat yellow Max}
i is  4
Added {Tesla S black Adriana}
i is  5
Added {Peugeot 205 purple Michel}
i is  6
Added {Chery S22L white Aarav}
i is  7
Added {Fiat Punto violet Pari}
i is  8
Added {Tata Nano indigo Valeria}
i is  9
Added {Holden Barina brown Shotaro}

docker logs c5a8910b63cd | tail -20

ex02 Invoke
Query Response:{"Name":"a","Amount":"100"}
ex02 Invoke
Aval = 90, Bval = 210

docker logs 83f46b5b696b | tail -20

2017-07-20 16:29:50.083 UTC [cauthdsl] func2 -> ERRO 1cc9 Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a
2017-07-20 16:29:51.749 UTC [cauthdsl] func2 -> ERRO 1cca Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a
2017-07-20 16:29:51.750 UTC [cauthdsl] func2 -> ERRO 1ccb Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a
2017-07-20 16:29:52.377 UTC [nodeCmd] func3 -> DEBU 1ccc sig: terminated
2017-07-20 16:29:52.377 UTC [fsblkstorage] Shutdown -> DEBU 1ccd closing fs blockStore:myfirst
2017-07-20 16:29:52.377 UTC [main] main -> INFO 1cce Exiting.....

when I add

depends_on:
  - orderer.example.com
  - couchdb # <--- Add this line 

It seemed to solve one error. But there are other errors.

when I excuted $logs d54cd21b93f8 | tail -20 (d54cd21b93f8 is the first Container), it returned:

2017-08-06 09:49:38.107 UTC [couchdb] handleRequest -> WARN 012 Retrying couchdb request in 125ms. Attempt:1  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 09:49:38.232 UTC [couchdb] handleRequest -> DEBU 013 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
2017-08-06 09:50:13.233 UTC [couchdb] handleRequest -> WARN 014 Retrying couchdb request in 250ms. Attempt:2  Error:Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2017-08-06 09:50:13.484 UTC [couchdb] handleRequest -> DEBU 015 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 

docker logs 83f46b5b696b | tail -20

2017-07-20 16:29:50.083 UTC [cauthdsl] func2 -> ERRO 1cc9 Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a
2017-07-20 16:29:51.749 UTC [cauthdsl] func2 -> ERRO 1cca Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a
2017-07-20 16:29:51.750 UTC [cauthdsl] func2 -> ERRO 1ccb Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org2.example.com")) for identity 0a074f7267324d53501280062d2d2d2d2d424547494e202d2d2d2d2d0a4d494943476a4343416343674177494241674952414a4362704f51766d31462f4d385a592f7252466c706377436759494b6f5a497a6a304541774977637a454c0a4d416b474131554542684d4356564d78457a415242674e5642416754436b4e6862476c6d62334a7561574578466a415542674e564241635444564e68626942470a636d467559326c7a593238784754415842674e5642416f54454739795a7a49755a586868625842735a53356a623230784844416142674e5642414d5445324e680a4c6d39795a7a49755a586868625842735a53356a623230774868634e4d5463774e7a49774d5451304d5449775768634e4d6a63774e7a45344d5451304d5449770a576a42624d517377435159445651514745774a56557a45544d4245474131554543424d4b5132467361575a76636d3570595445574d4251474131554542784d4e0a5532467549455a795957356a61584e6a627a45664d4230474131554541784d576347566c636a457562334a6e4d69356c654746746347786c4c6d4e766254425a0a4d424d4742797147534d34394167454743437147534d34394177454841304941424b32676b45746a45577475726b68576f4a4b74694f6a6c66503368526b61390a47326743742b4a58544a3653632b6e49622f6954502f41505a542f794f364c6a5852663247447a6234763945434d6b6270336c434978536a5454424c4d4134470a41315564447745422f775145417749486744414d42674e5648524d4241663845416a41414d437347413155644977516b4d434b41494c6f6e6d4e4d51734668350a554468316149547a747550486e706f30454a716a326e4d6a376857335277424f4d416f4743437147534d343942414d43413067414d4555434951434b6f396c780a334355447a7549696e7474444e6550696e4251517841797174504a72467a32443937793138674967657977327435313456653157516d6d506239706b4b6844520a7261516c77344b4b72722b634f434a767051383d0a2d2d2d2d2d454e44202d2d2d2d2d0a

Can anyone tell me why??

  • It fails to get connected to endorsing peer, can you please show the output of "docker ps?" – Artem Barger Aug 06 '17 at 08:37
  • f1b62c64395c hyperledger/fabric-orderer:x86_64-1.0.0 "orderer" 34 minutes ago Up 34 minutes 0.0.0.0:7050->7050/tcp orderer.example.com 4ad55e4adab7 hyperledger/fabric-ca:x86_64-1.0.0 "sh -c 'fabric-ca-..." 34 minutes ago Up 34 minutes 0.0.0.0:7054->7054/tcp ca.example.com 0d785602a2c8 hyperledger/fabric-couchdb:x86_64-1.0.0 "tini -- /docker-e..." 34 minutes ago Up 34 minutes 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb – Nguyễn Huy Hoàng Aug 06 '17 at 08:40
  • could you edit your question and post those results formatted? – Artem Barger Aug 06 '17 at 08:42
  • f1b62c64395c hyperledger/fabric-orderer:x86_64-1.0.0 "orderer" 34 minutes ago Up 34 minutes 0.0.0.0:7050->7050/tcp orderer.example.com – Nguyễn Huy Hoàng Aug 06 '17 at 08:42
  • Please add them into your question in readable format. – Artem Barger Aug 06 '17 at 08:43
  • Wait a minute, please. – Nguyễn Huy Hoàng Aug 06 '17 at 08:43
  • I edited my question @ArtemBarger – Nguyễn Huy Hoàng Aug 06 '17 at 08:48
  • seems like peer container has not started or failed during initialization. please do following steps: 1) docker ps -a | grep peer0 2) Extract container id from previous output 3) docker logs 4) attach to your question last 10-20 lines, e.g. "docker logs containerID | tail -20". – Artem Barger Aug 06 '17 at 08:59
  • Thank you, @ArtemBarger. I updated my question. Is this enough information for you? – Nguyễn Huy Hoàng Aug 06 '17 at 09:32

2 Answers2

2

Based on the information you have posted in your question, the reason for the error:

*Error: Error getting endorser client channel: PER:404 - Error trying to connect to local peer*
/opt/gopath/src/github.com/hyperledger/fabric/peer/common/common.go:116 github.com/hyperledger/fabric/peer/common.GetEndorserClient
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:149 github.com/hyperledger/fabric/peer/channel.InitCmdFactory
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:138 github.com/hyperledger/fabric/peer/channel.join
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:42 github.com/hyperledger/fabric/peer/channel.joinCmd.func1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute
/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 main.main
/opt/go/src/runtime/proc.go:192 runtime.main
/opt/go/src/runtime/asm_amd64.s:2087 runtime.goexit
Caused by: context deadline exceeded

Primarily due to the fact that peer container is down, hence peer cli cannot reach endorsing peer and therefore failing. Now the reason it fail, because it cannot reach couchdb:

panic: Error in instantiating ledger provider: Unable to connect to CouchDB, check the hostname and port: Get http://couchdb:5984/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

goroutine 1 [running]:
panic(0xc917e0, 0xc42025a2c0)
    /opt/go/src/runtime/panic.go:500 +0x1a1
github.com/hyperledger/fabric/core/ledger/ledgermgmt.initialize()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:61 +0x2fe
github.com/hyperledger/fabric/core/ledger/ledgermgmt.Initialize.func1()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:49 +0x14
sync.(*Once).Do(0x143e768, 0xe291b0)
    /opt/go/src/sync/once.go:44 +0xdb
github.com/hyperledger/fabric/core/ledger/ledgermgmt.Initialize()
    /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:50 +0x39
github.com/hyperledger/fabric/peer/node.serve(0x143e6a8, 0x0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:88 +0x113
github.com/hyperledger/fabric/peer/node.glob..func1(0x13e5260, 0x143e6a8, 0x0, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:75 +0x3f
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute(0x13e5260, 0x143e6a8, 0x0, 0x0, 0x13e5260, 0x143e6a8)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 +0x234
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x13e58c0, 0xf, 0xc420012035, 0x7)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 +0x367
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute(0x13e58c0, 0x1a, 0xc420012035)
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 +0x2b
main.main()
    /opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 +0x54

By looking on docker-compose file in basic-network folder it seems that startup of the peer container is not dependent on couchdb container:

  peer0.org1.example.com:
    container_name: peer0.org1.example.com
    image: hyperledger/fabric-peer:x86_64-1.0.0
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer0.org1.example.com
      - CORE_LOGGING_PEER=debug
      - CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
      - CORE_PEER_LOCALMSPID=Org1MSP
      - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
      - CORE_PEER_ADDRESS=peer0.org1.example.com:7051
      # # the following setting starts chaincode containers on the same
      # # bridge network as the peers
      # # https://docs.docker.com/compose/networking/
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic
      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
    command: peer node start
    # command: peer node start --peer-chaincodedev=true
    ports:
      - 7051:7051
      - 7053:7053
    volumes:
        - /var/run/:/host/var/run/
        - ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/msp/peer
        - ./crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/msp/users
        - ./config:/etc/hyperledger/configtx
    depends_on:
      - orderer.example.com
    networks:
      - basic

The fix should be rather simply, just to add dependency to make sure couchdb is available while running the peer container:

depends_on:
  - orderer.example.com
  - couchdb # <--- Add this line 
Artem Barger
  • 40,769
  • 9
  • 59
  • 81
  • Hi @Artem Barger. It seems to have other error. I updated my question. Please help me check my problem. – Nguyễn Huy Hoàng Aug 06 '17 at 10:13
  • I would suggest to clean up docker images and containers and start over again. 1) "docker ps -qa | xargs docker stop"; 2) "docker ps -qa | xargs docker rm" and also remove chaincode images "docker images | grep dev-peer0 | awk '{ print $2; }' | xagrs docker rmi" – Artem Barger Aug 06 '17 at 11:10
  • At any case previous error fixed with: https://jira.hyperledger.org/browse/FAB-5631, should be available during next release. – Artem Barger Aug 06 '17 at 14:10
2

The only solution which worked for me is increasing sleep time to start fabric.Follow the following the procedure

  1. Delete all hyperledger docker images before starting fabric (startFabric.sh will download latest images again).

    To delete all containers including its volumes use,

    docker rm -vf $(docker ps -a -q)
    

    To delete all the images,

    docker rmi -f $(docker images -a -q)
    
  2. open basic-network/start.sh

  3. make FABRIC_START_TIMEOUT=90 (default 10)
  4. ./startFabric.sh
Shahid Hussain
  • 1,599
  • 1
  • 20
  • 24