我尝试使用以下命令查询事务并看到以下错误
peer chaincode query -n <chaincodeId> -c '{"Function": "query", "Args": ["a"]}' -u jim
23:52:59.542 [crypto] main -> INFO 001 Log level recognized 'info', set to INFO
Usage:
peer chaincode query [flags]
Flags:
-x, --hex[=false]: If true, output the query value byte array in hexadecimal. Incompatible with --raw
-r, --raw[=false]: If true, output the query value as raw bytes, otherwise format as a printable string
Global Flags:
-c, --ctor="{}": Constructor message for the chaincode in JSON format
-l, --lang="golang": Language the chaincode is written in
--logging-level="": Default logging level and overrides, see core.yaml for full syntax
-n, --name="": Name of the chaincode returned by the deploy transaction
-p, --path="": Path to chaincode
-u, --username="": Username for chaincode operations when security is enabled
错误:查询链码时出错:rpc错误:代码= 2 desc =&#34;错误:无法启动链码规范(启动容器时出错:无法连接到Docker端点)&#34;
我在NON-DEV模式下运行对等体(模式:net)。在net模式下,验证器将在docker容器中运行chaincode。
对等节点日志的简要总结
23:14:57.568 [devops] invokeOrQuery - &gt; DEBU 03c使用上下文jim初始化安全devops 23:14:57.568 [crypto] invokeOrQuery - &gt; INFO 03d初始化客户端[jim] ... 23:14:57.682 [crypto] invokeOrQuery - &gt; INFO 03e初始化客户端[jim] ...完成! 23:14:57.682 [devops] createExecTx - &gt; DEBU 03f创建安全调用事务774fd330-ed1f-4a4d-b472-15386f3b5505 23:14:57.683 [devops] invokeOrQuery - &gt; DEBU 040将调用事务(774fd330-ed1f-4a4d-b472-15386f3b5505)发送到验证器 23:14:57.683 [peer] sendTransactionsToLocalEngine - &gt; DEBU 041编组事务CHAINCODE_QUERY发送到本地引擎 23:14:57.683 [peer] sendTransactionsToLocalEngine - &gt; DEBU 042使用时间戳秒发送消息CHAIN_TRANSACTION:1463786097 nanos:683657855到本地引擎 23:14:57.950 [chaincode] getArgsAndEnv - &gt; DEBU 043可执行文件是/ opt / gopath / bin / 7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429d379bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568 23:14:57.950 [chaincode] launchAndWaitForRegister - &gt; DEBU 044 启动容器:7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429d379bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568(networkid:dev,peerid:vp0) 23:14:57.950 [container] lockContainer - &gt; DEBU 045 等待容器(dev-vp0-7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429d379bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568)lock 23:14:57.950 [container] lockContainer - &gt; DEBU 046 得到容器(dev-vp0-7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429dc9bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568)lock 23:14:57.950 [dockercontroller]开始 - &gt; DEBU 047 清理容器 dev-vp0-7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429d379bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568 23:14:57.950 [dockercontroller] stopInternal - &gt; DEBU 048 停止容器 dev-vp0-7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429d379bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568(无法连接到Docker端点) 23:14:57.950 [dockercontroller] stopInternal - &gt; DEBU 049 杀死容器 dev-vp0-7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429d379bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568(无法连接到Docker端点) 23:14:57.951 [dockercontroller] stopInternal - &gt; DEBU 04a 删除容器 dev-vp0-7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429d379bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568(无法连接到Docker端点) 23:14:57.951 [dockercontroller]开始 - &gt; DEBU 04b 启动容器 dev-vp0-7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429d379bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568 23:14:57.951 [dockercontroller] createContainer - &gt; DEBU 04c 创建容器:dev-vp0-7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429d379bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568 23:14:57.951 [dockercontroller]开始 - &gt; ERRO 04d start-无法重新创建容器无法连接到Docker端点 23:14:57.951 [container] unlockContainer - &gt; DEBU 04e 容器锁已删除(dev-vp0-7849b0cdbc04a8498e3601188bf4ef87d25b5efda9d89cdb879914fcbbe544a429d379bdcb210e2ba7de131ee84b53b974e3afcbacbcf0e2db4ec408a4ddb568) 23:14:57.951 [chaincode] LaunchChaincode - &gt; DEBU 04f launchAndWaitForRegister失败错误启动容器:无法连接到Docker端点 23:14:57.951 [crypto] CloseClient - &gt; INFO 050关闭客户端[jim] ...
问题是为什么容器被脱机也被终止了?
答案 0 :(得分:0)
尝试 CORE_PEER_ADDRESS = 172.17.0.2:30303 peer chaincode query -l golang -n -c'{“Function”:“query”,“Args”:[“a”]}'-u jim
看起来您的docker容器未正确启动,您是否在init对等日志中有任何错误
答案 1 :(得分:0)
请务必为已安装的泊坞窗设置以下选项:
-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock