我的docker-compose与default one相同,只是它具有以下附加代码:
hyperledger:
build:
context: .
ports:
- 8081:8081
我的Dockerfile:
FROM hyperledger/composer-cli:0.19.0
WORKDIR /app
COPY . /app
USER root
RUN chown -R composer:composer .
USER composer
RUN ls -la
# RUN composer archive create -t dir -n .
RUN rm -rf .stage && mkdir ./.stage
RUN echo '{"name": "hyper-discover-network","x-type": "hlfv1","x-commitTimeout": 300,"version": "1.0.0","client": {"organization": "Org1","connection": {"timeout": {"peer": {"endorser": "300","eventHub": "300","eventReg": "300"},"orderer": "300"}}},"channels": {"composerchannel": {"orderers": ["orderer.example.com"],"peers": {"peer0.org1.example.com": {}}}},"organizations": {"Org1": {"mspid": "Org1MSP","peers": ["peer0.org1.example.com"],"certificateAuthorities": ["ca.org1.example.com"]}},"orderers": {"orderer.example.com": {"url": "grpc://orderer.example.com:7050"}},"peers": {"peer0.org1.example.com": {"url": "grpc://peer0.org1.example.com:7051","eventUrl": "grpc://peer0.org1.example.com:7053"}},"certificateAuthorities": {"ca.org1.example.com": {"url": "http://ca.org1.example.com:7054","caName": "ca.org1.example.com"}}}' > connection.json
EXPOSE 8081
USER root
RUN chmod 777 docker-entrypoint.sh
COPY docker-entrypoint.sh /usr/local/bin/
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
ENTRYPOINT [ "sh", "/app/docker-entrypoint.sh" ]
CMD [ "composer" ]
还有我的docker-entrypoint.sh:
#!/bin/bash
# set -e
if [ "$1" = 'composer' ]; then
composer archive create -t dir -n .
echo '{...}' > connection.json
composer card create -p ./connection.json -u PeerAdmin -r PeerAdmin -r ChannelAdmin -f .stage/PeerAdmin.card \
-c crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem \
-k crypto-config/peerOrganizations/org1.example.com/ca/19ab65abbb04807dad12e4c0a9aaa6649e70868e3abd0217a322d89e47e1a6ae_sk
# composer-playground
composer card import -f .stage/PeerAdmin.card && composer card list && ls -la && pwd
echo 'som shit'
composer network install -a hyper-discover-network@0.0.1.bna -c PeerAdmin@hyper-discover-network
fi
错误出现在composer network install ...
行。
我通过执行以下命令来构建此环境:./startFabric.sh && docker-compose up hyperledger