Chaincode 在 Hyperledger Fabric 上部署失败
Chaincode deploying fails on Hyperledger Fabric
我正在尝试 运行 fabric-samples 文件夹中的样本测试网络,但由于某种原因,链码安装失败,给我一个错误。这是我尝试 运行 deployCC
命令时得到的所有信息:
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: cannot connect to Docker endpoint
Chaincode installation on peer0.org1 has failed
Deploying chaincode failed
$ ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-java -ccl java
deploying chaincode on channel 'mychannel'
executing with the following
- CHANNEL_NAME: mychannel
- CC_NAME: basic
- CC_SRC_PATH: ../asset-transfer-basic/chaincode-java
- CC_SRC_LANGUAGE: java
- CC_VERSION: 1.0
- CC_SEQUENCE: 1
- CC_END_POLICY: NA
- CC_COLL_CONFIG: NA
- CC_INIT_FCN: NA
- DELAY: 3
- MAX_RETRY: 5
- VERBOSE: false
Compiling Java code...
~/Desktop/fabric-samples/asset-transfer-basic/chaincode-java ~/Desktop/fabric-samples/test-network
Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
<-------------> 0% INITIALIZING [118ms]
<-------------> 0% INITIALIZING [627ms]
<-------------> 0% CONFIGURING [919ms]
<-------------> 0% CONFIGURING [2s]
> root <==-----------> 20% EXECUTING [3s]
> r<======-------> 53% EXECUTING [3s]
<===========--> 86% EXECUTING [4s]tRuntimeClasspath
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 12s
10 actionable tasks: 2 executed, 8 up-to-date
~/Desktop/fabric-samples/test-network
Finished compiling Java code
+ peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-java/build/install/basic --lang java --label basic_1.0
+ res=0
Chaincode is packaged
Installing chaincode on peer0.org1...
Using organization 1
+ peer lifecycle chaincode install basic.tar.gz
+ res=1
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: cannot connect to Docker endpoint
Chaincode installation on peer0.org1 has failed
Deploying chaincode failed
我在 Docker Windows 上 运行 宁此,不幸的是,我在互联网上找到的所有有用的答案都与关闭 gRPC 功能有关, Windows.
不支持
如有任何帮助,我们将不胜感激,我已尝试卸载所有内容(包括二进制文件)并重新安装,但过去 2 天都没有成功。
设置网络和频道创建没有 errors/warnings,所以我猜这是一个与 docker 相关的通信问题。
问题是测试网络使用内置的链码构建器和启动器,这需要在 windows 设置上访问您的 docker。报错是无法连接。
如果您使用的是 fabric-samples 的主要分支,那么可以在 window shell 中启动测试网络之前尝试设置 DOCKER_SOCK 环境变量。查看 https://docs.docker.com/desktop/faqs/ 以了解您可以将其设置为什么。另请查看在不安全端口上公开 docker 守护进程的选项,这可能会有所帮助。
DOCKER_SOCK 选项已添加到 main 中的 fabric-samples,但似乎不在 2.2 分支中,因此请注意,您在这里使用的不是 fabric LTS 版本
需要注意的是我没有尝试过这个所以不能保证它会起作用
不幸的是,目前 Windows 使用 fabric 并没有得到太多关注,所以我现在可以给你的最好建议是使用 linux 作为你的平台(你可以使用WSL2,但您应该 google 安装 docker 到 WSL2 发行版中,因为它确实需要一些额外的工作)
谢谢@格鲁,@david_k
问题是 Docker 没有正确地将容器暴露给我正在使用的 Git-bash CLI(...)
所以,我尝试了 WSL2:设置 Ubuntu、安装 Hyperledger 和 GO 只用了大约 30 分钟,并启动了示例链码和 运行!
我没有重新安装 Docker。我正在使用 Docker 桌面版本 4.1.1 (69879),它在设置-->资源-->WSL 集成中具有将容器暴露给所有 WSL 的惊人 功能-已安装的发行版(!!!)。
自第一次尝试以来,测试链代码运行速度非常快且非常流畅!
我正在尝试 运行 fabric-samples 文件夹中的样本测试网络,但由于某种原因,链码安装失败,给我一个错误。这是我尝试 运行 deployCC
命令时得到的所有信息:
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: cannot connect to Docker endpoint
Chaincode installation on peer0.org1 has failed
Deploying chaincode failed
$ ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-java -ccl java
deploying chaincode on channel 'mychannel'
executing with the following
- CHANNEL_NAME: mychannel
- CC_NAME: basic
- CC_SRC_PATH: ../asset-transfer-basic/chaincode-java
- CC_SRC_LANGUAGE: java
- CC_VERSION: 1.0
- CC_SEQUENCE: 1
- CC_END_POLICY: NA
- CC_COLL_CONFIG: NA
- CC_INIT_FCN: NA
- DELAY: 3
- MAX_RETRY: 5
- VERBOSE: false
Compiling Java code...
~/Desktop/fabric-samples/asset-transfer-basic/chaincode-java ~/Desktop/fabric-samples/test-network
Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
<-------------> 0% INITIALIZING [118ms]
<-------------> 0% INITIALIZING [627ms]
<-------------> 0% CONFIGURING [919ms]
<-------------> 0% CONFIGURING [2s]
> root <==-----------> 20% EXECUTING [3s]
> r<======-------> 53% EXECUTING [3s]
<===========--> 86% EXECUTING [4s]tRuntimeClasspath
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 12s
10 actionable tasks: 2 executed, 8 up-to-date
~/Desktop/fabric-samples/test-network
Finished compiling Java code
+ peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-java/build/install/basic --lang java --label basic_1.0
+ res=0
Chaincode is packaged
Installing chaincode on peer0.org1...
Using organization 1
+ peer lifecycle chaincode install basic.tar.gz
+ res=1
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: cannot connect to Docker endpoint
Chaincode installation on peer0.org1 has failed
Deploying chaincode failed
我在 Docker Windows 上 运行 宁此,不幸的是,我在互联网上找到的所有有用的答案都与关闭 gRPC 功能有关, Windows.
不支持如有任何帮助,我们将不胜感激,我已尝试卸载所有内容(包括二进制文件)并重新安装,但过去 2 天都没有成功。
设置网络和频道创建没有 errors/warnings,所以我猜这是一个与 docker 相关的通信问题。
问题是测试网络使用内置的链码构建器和启动器,这需要在 windows 设置上访问您的 docker。报错是无法连接。
如果您使用的是 fabric-samples 的主要分支,那么可以在 window shell 中启动测试网络之前尝试设置 DOCKER_SOCK 环境变量。查看 https://docs.docker.com/desktop/faqs/ 以了解您可以将其设置为什么。另请查看在不安全端口上公开 docker 守护进程的选项,这可能会有所帮助。
DOCKER_SOCK 选项已添加到 main 中的 fabric-samples,但似乎不在 2.2 分支中,因此请注意,您在这里使用的不是 fabric LTS 版本
需要注意的是我没有尝试过这个所以不能保证它会起作用
不幸的是,目前 Windows 使用 fabric 并没有得到太多关注,所以我现在可以给你的最好建议是使用 linux 作为你的平台(你可以使用WSL2,但您应该 google 安装 docker 到 WSL2 发行版中,因为它确实需要一些额外的工作)
谢谢@格鲁,@david_k
问题是 Docker 没有正确地将容器暴露给我正在使用的 Git-bash CLI(...)
所以,我尝试了 WSL2:设置 Ubuntu、安装 Hyperledger 和 GO 只用了大约 30 分钟,并启动了示例链码和 运行!
我没有重新安装 Docker。我正在使用 Docker 桌面版本 4.1.1 (69879),它在设置-->资源-->WSL 集成中具有将容器暴露给所有 WSL 的惊人 功能-已安装的发行版(!!!)。
自第一次尝试以来,测试链代码运行速度非常快且非常流畅!