Hyper ledger Fabric 2.3 部署链码中遇到的问题
Docker版本太新
Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image inspection failed: Get "http://unix.sock/images/dev-peer0.org1.example.com-basic_1.0-4ec191e793b27e953ff2ede5a8bcc63152cecb1e4c3f301a26e22692c61967ad-42f57faac8360472e47cbbbf3940e81bba83439702d085878d148089a1b213ca/json": dial unix /host/var/run/docker.sock: connect: no such file or directory Chaincode installation on peer0.org1 has failed Deploying chaincode failed
此问题是由适用于 macOS 的较新版本的 Docker Desktop 引起的。要解决此问题,请在 Docker 桌面首选项中取消选中该框以使用旧版 osxfs 文件共享,然后单击应用并重新启动。Use gRPC FUSE for file sharing
若是在linux下也遇到此问题,输入docker version
检查EXPERIMENTAL
是否是TRUE
,如是的话,输
sudo vim /etc/docker/daemon.json
// 这是一个新文件,直接照抄然后:wq保存退出即可
{
"experimental": true
};
再次检查docker verion
,确认关闭后重启测试网即可。
代理链接被拒绝
Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 "go: github.com/golang/protobuf@v1.3.2: Get "https://proxy.golang.org/github.com/golang/protobuf/@v/v1.3.2.mod": dial tcp 172.217.24.17:443: connect: connection refused
若出现类似情况,
// 到链码所在的目录下提前下载依赖包
cd fabric-samples/asset-transfer-basic/chaincode-go
//更改GO代理
go env -w GOPROXY=https://goproxy.io,direct
go env -w GO111MODULE=on
go mod vendor
之后重启网络部署 重新使用deployCC
指令即可
GO版本太低
Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 "go: inconsistent vendoring in /chaincode/input/src:
之前用的版本是GO 1.13的,好像必须要1.15及以上,删除卸载原环境路径下的GO然后重新安装1.17.1版本的后,该问题解决。
PS:Ubuntu配置环境路径的方法有很多,其中vim ~/.bashrc
后面配置路径的话不仅需要source ~/.bashrc
运行一次,还需要reboot
,然后终端打go version
或者go env
才会发现版本更新完成,不然就会像我一样打破脑袋也想不明白为啥明明更新完bin了 go version
显示的还是1.13。orz
附上链码部署成功的胜利者截图一张: