网络中的第一个节点是否有可能不在 Docker 容器中启动?(例如,它可以作为使用 的进程启动peer node start
)
我们可以验证 vagrant 机器中可用的 docker 镜像。只需运行docker images
命令:
vagrant@hyperledger-devenv:v0.0.9-b4acc4b:$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hyperledger/fabric-baseimage latest c1d6f4800a55 27 hours ago 1.297 GB
hyperledger/fabric-baseimage x86_64-0.0.9 70328eed56aa 2 weeks ago 990.1 MB
busybox latest 47bcc53f74dc 9 weeks ago 1.113 MB
通过这样的配置,当“hyperledger-peer”镜像不可用时,Validation Peer 将不会因为“Unable to find image”错误而启动:
vagrant@hyperledger-devenv:v0.0.9-b4acc4b:/opt/gopath/src/github.com/hyperledger/fabric/peer$ docker run --rm -it -e CORE_VM_ENDPOINT=http://172.17.0.1:2375 -e CORE_PEER_ID=vp0 -e CORE_PEER_ADDRESSAUTODETECT=true hyperledger-peer peer node start
Unable to find image 'hyperledger-peer:latest' locally
Pulling repository docker.io/library/hyperledger-peer
docker: Error: image library/hyperledger-peer not found.
可以使用以下方法创建“hyperledger-peer:latest”图像:
cd $GOPATH/src/github.com/hyperledger/fabric/core/container
go test -run BuildImage_Peer
现在docker images
应该再显示一张可用的图像:
REPOSITORY TAG IMAGE ID CREATED SIZE
hyperledger-peer latest 438b65f18f21 8 seconds ago 1.418 GB
此时Validation Peer应该已经启动成功:
vagrant@hyperledger-devenv:v0.0.9-b4acc4b:~$ docker run —rm -it -e CORE_VM_ENDPOINT=http://172.17.0.1:2375 -e CORE_PEER_ID=vp0 -e CORE_PEER_ADDRESSAUTODETECT=true hyperledger-peer peer node start
21:55:51.969 [crypto] main -> INFO 001 Log level recognized 'info', set to INFO
21:55:51.970 [peer] func1 -> INFO 002 Auto detected peer address: 172.17.0.2:30303
21:55:51.971 [peer] func1 -> INFO 003 Auto detected peer address: 172.17.0.2:30303
21:55:51.972 [peer] func1 -> INFO 004 Auto detected peer address: 172.17.0.2:30303
21:55:51.974 [main] serve -> INFO 005 Security enabled status: false
21:55:51.974 [main] serve -> INFO 006 Privacy enabled status: false
…