在ubuntu中通過docker-compose啟動容器的時候報錯
ERROR: for cli Cannot create container for service cli: Conflict. The container name "/cli" is already in use by container
"50c55d747c3c5a8563219d0404bcd49945fc45ebc69d6cd432d7570512d0ed4a".
You have to remove (or rename) that container to be able to reuse that name.
ERROR: Encountered errors while bringing up the project.
原因: cli的名字沖突了,
解決辦法: 刪掉cli容器或者在docker-compose-cli.yaml文件中對命名進行修改,但是我并沒有發(fā)現(xiàn)有cli容器,所以就進行了命名的修改.
啟動容器:
$ docker-compose -f docker-compose-cli.yaml up -d
創(chuàng)建channel的時候報錯
Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- error authorizing update: error validating DeltaSet: policy for [Group] /Channel/Application not satisfied: Failed to reach implicit threshold of 1 sub-policies, required 1 remaining
查找錯誤的原因思路: 創(chuàng)建通道肯定是客戶端要做的事情,所以就在客戶端的環(huán)境變量設置這塊去入手, 發(fā)現(xiàn)了問題所在:
cli要連接的節(jié)點所屬的組織ID寫錯了, 在configtx.yaml中是這樣寫的
創(chuàng)建channel文件或者創(chuàng)世區(qū)塊文件報錯
Error reading configuration: While parsing config: yaml: line 117: did not find expected key
panic: Error reading configuration: While parsing config: yaml: line 117: did not find expected key [recovered]
panic: Error reading configuration: While parsing config: yaml: line 117: did not find expected key
錯誤原因:高度懷疑是使用Xcode來打開了configtx.yaml文件, 造成了格式上的錯亂 (雖然看起來一點變化都沒有,使用二分大法確實能驗證出來是有錯誤,但就是找不到錯誤在哪),要知道, yaml文件的縮進只支持空格縮進,并不支持tab縮進.
解決辦法:
先將configtx.yaml文件的內(nèi)容剪切出來,放在象印筆記上粘貼,再關閉configtx.yaml文件
打開configtx.yaml文件, 從象印筆記上把內(nèi)容再粘貼回到configtx.yaml文件.
如果上面方法不行的話,重新創(chuàng)建一個configtx.yaml文件,重新寫部署代碼.
創(chuàng)建channel文件時報錯
Error: failed to create deliver client: orderer client failed to connect to orderer.test.com:7050: failed to create new connection: context deadline exceeded
出現(xiàn)這個錯誤時,首先看一看orderer服務有沒有開啟,如果是開啟的狀態(tài),那就是docker-compose.yaml文件的問題了, 檢查一下環(huán)境變量有沒有寫對, 如果都沒問題的話,那就是yaml文件格式的問題了.
創(chuàng)建channel文件時報錯
Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- error authorizing update: error validating ReadSet: readset expected key [Group] /Channel/Application at version 0, but got version 1
創(chuàng)建通道的時候,報這個錯!! 已經(jīng)存在通道了,就不要再添加了,可以通過 peer channel list來查看通道.
將節(jié)點加入到通道中報錯
Error: error getting endorser client for channel: endorser client failed to connect to peer0.orggo.test.com:7051: failed to create new connection: context deadline exceeded
Mac和ubuntu之間會發(fā)生這個問題,暫時不知道解決方案.
Mac和centos之間也會發(fā)生這個問題,但是關閉centos的防火墻就可以解決問題.
$ firewall-cmd --state #查看默認防火墻狀態(tài)(關閉后顯示notrunning,開啟后顯示running)
$ systemctl stop firewalld.service #停止firewall
$ firewall-cmd --state #查看默認防火墻狀態(tài)(關閉后顯示notrunning明也,開啟后顯示running)
啟動容器的時候
ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule: (iptables failed: iptables --wait -t nat -I DOCKER -i br-70aea9556247 -j RETURN: iptables: No chain/target/match by that name.
執(zhí)行docker-compose up -d 啟動容器的時候, 報這個錯,解決辦法: 重啟docker
service docker restart