Hyperledger cli容器不会与主机

时间:2018-04-24 22:53:06

标签: docker-compose hyperledger-fabric

我正在尝试从我的Windows 10 Linux子系统(Ubuntu Xenial)实现BYFN Hyperledger example。但是,./byfn.sh -m up命令失败并显示以下输出:

$GOPATH/fabric-samples/first-network$ ./byfn.sh -m up
Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
2018-04-24 22:12:44.343 UTC [main] main -> INFO 001 Exiting.....
LOCAL_VERSION=1.1.0
DOCKER_IMAGE_VERSION=1.1.0
Creating peer0.org1.example.com ... done
Creating orderer.example.com    ... done
Creating peer1.org1.example.com ... done
Creating peer0.org2.example.com ... done
Creating peer1.org2.example.com ... done
Creating cli                    ... done
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"scripts/script.sh\": stat scripts/script.sh: no such file or directory": unknown
ERROR !!!! Test failed

我看到只构建了一个容器:

$GOPATH/fabric-samples/first-network$ dps
CONTAINER ID         NAMES              NETWORKS            STATUS              SIZE
3e66d31c6b9a         cli                net_byfn            Up 27 minutes       17B (virtual 1.46GB)

从输出看来,cli容器似乎无法看到script.sh脚本。想到这可能是一个docker-compose volume-bind问题,我试图检查cli容器中的绑定:

$GOPATH/fabric-samples/first-network$ docker exec -ti cli bash

root@3e66d31c6b9a:/opt/gopath/src/github.com/hyperledger/fabric/peer# ls scripts/

root@3e66d31c6b9a:/opt/gopath/src/github.com/hyperledger/fabric/peer# exit
exit
$GOPATH/fabric-samples/first-network$ ls scripts/
capabilities.json  script.sh  step1org3.sh  step2org3.sh  step3org3.sh  testorg3.sh  upgrade_to_v11.sh  utils.sh

查看docker-compose-cli.yaml文件,我看到以下cli容器的绑定:

volumes:
    - /var/run/:/host/var/run/
    - ./../chaincode/:/opt/gopath/src/github.com/chaincode
    - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
    - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
    - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts

我的Docker设置:

$GOPATH/fabric-samples/first-network$ docker version
Client:
 Version:       18.03.0-ce
 API version:   1.37
 Go version:    go1.9.2
 Git commit:    0520e24
 Built: Wed Mar 21 23:05:52 2018
 OS/Arch:       linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.03.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   0520e24
  Built:        Wed Mar 21 23:14:32 2018
  OS/Arch:      linux/amd64
  Experimental: false
$GOPATH/fabric-samples/first-network$ docker-compose version
docker-compose version 1.21.0, build 5920eb0
docker-py version: 3.2.1
CPython version: 3.6.5
OpenSSL version: OpenSSL 1.0.1t  3 May 2016

我的Go版本:

$GOPATH/fabric-samples/first-network$ go version
go version go1.10.1 linux/amd64

想知道我是否遗漏了什么。我应该提一下,我使用以下命令来开始表格划痕,基于一组新的图像(没有先前的图像),如script中所述:

curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s 1.1.0

由于

2 个答案:

答案 0 :(得分:0)

最有可能是golang --- Fabric needs go version 1.9.x的版本,错误消息exec failed: container_linux.go:348:表示同样的事情。

答案 1 :(得分:0)

就我而言,它是此页面https://hyperledger-fabric.readthedocs.io/en/latest/install.html上的第一个Note 我在Windows 10上运行,但是Docker无法运行,因为我需要Windows 10 Pro或更高版本才能运行它。因此,我使用的是Docker Toolbox,必须遵循Windows 7技巧,将源代码克隆到C:\Users

下的任何位置