Docker images for Hyperledger fabric peer.
latest
(latest/Dockerfile): Track latest code on master branch.release-v2.5
(release-v2.5/Dockerfile): 2.5 release.2.5.0
(v2.5.0/Dockerfile): 2.5.0 release.release-v2.4
(release-v2.4/Dockerfile): 2.4 release.2.4.7
(v2.4.7/Dockerfile): 2.4.7 release.2.4.5
(v2.4.5/Dockerfile): 2.4.5 release.2.4.0
(v2.4.0/Dockerfile): 2.4.0 release.release-v2.3
(release-v2.3/Dockerfile): 2.3 release.2.3.3
(v2.3.3/Dockerfile): 2.3.3 release.2.3.2
(v2.3.2/Dockerfile): 2.3.2 release.2.3.0
(v2.3.0/Dockerfile): 2.3.0 release.release-v2.2
(release-v2.2/Dockerfile): 2.2 LTS release.2.2.10
(v2.2.10/Dockerfile): 2.2.10 release.2.2.9
(v2.2.9/Dockerfile): 2.2.9 release.2.2.8
(v2.2.8/Dockerfile): 2.2.8 release.2.2.4
(v2.2.4/Dockerfile): 2.2.4 release.2.2.3
(v2.2.3/Dockerfile): 2.2.3 release.2.2.1
(v2.2.1/Dockerfile): 2.2.1 release.2.2.0
(v2.2.0/Dockerfile): 2.2.0 release.2.1.0
(v2.1.0/Dockerfile): 2.1.0 release.release-v2.0
(release-v2.0/Dockerfile): 2.0 release.2.0.0
(v2.0.0/Dockerfile): 2.0.0 release.release-v1.4
(release-v1.4/Dockerfile): 1.4 LTS release.1.4.12
(v1.4.12/Dockerfile): 1.4.12 release.1.4.10
(v1.4.10/Dockerfile): 1.4.10 release.1.4.9
(v1.4.9/Dockerfile): 1.4.9 release.1.4.8
(v1.4.8/Dockerfile): 1.4.8 release.1.4.7
(v1.4.7/Dockerfile): 1.4.7 release.1.4.6
(v1.4.6/Dockerfile): 1.4.6 release.1.4.5
(v1.4.5/Dockerfile): 1.4.5 release.1.4.4
(v1.4.4/Dockerfile): 1.4.4 release.1.4.3
(v1.4.3/Dockerfile): 1.4.3 release.1.4.2
(v1.4.2/Dockerfile): 1.4.2 release.1.4.1
(v1.4.1/Dockerfile): 1.4.1 release.1.4.0
(v1.4.0/Dockerfile): 1.4.0 release.1.3.0
(v1.3.0/Dockerfile): 1.3.0 release.1.2.0
(v1.2.0/Dockerfile): 1.2.0 release.1.1.0
(v1.1.0/Dockerfile): 1.1.0 release.1.1.0-rc1
(v1.1.0-rc1/Dockerfile): 1.1.0-rc1 release.1.0.6
(v1.0.6/Dockerfile): 1.0.6 release.1.1.0-alpha
(v1.1.0-alpha/Dockerfile): 1.1.0-alpha release.1.1.0-preview
(v1.1.0-preview/Dockerfile): 1.1.0-preview release.1.0.5
(v1.0.5/Dockerfile): 1.0.5 release.1.0.4
(v1.0.4/Dockerfile): 1.0.4 release.1.0.3
(v1.0.3/Dockerfile): 1.0.3 release.1.0.2
(v1.0.2/Dockerfile): 1.0.2 release.1.0.1
(v1.0.1/Dockerfile): 1.0.1 release.1.0.0
(v1.0.0/Dockerfile): 1.0.0 release.1.0.0-rc1
(v1.0.0-rc1/Dockerfile): 1.0.0-rc1 release.1.0.0-beta
(v1.0.0-beta/Dockerfile): 1.0.0-beta release.1.0.0-alpha2
(v1.0.0-alpha2/Dockerfile): 1.0.0-alpha2 release.1.0.0-alpha
(v1.0.0-alpha/Dockerfile): 1.0.0-alpha release.0.6-dp
(0.6-dp/Dockerfile): Use 0.6-developer-preview release.
For more information about this image and its history, please see the relevant manifest file in the yeasy/docker-hyperledger-fabric-peer
GitHub repo.
If you want to quickly deploy a local cluster without any configuration and vagrant, please refer to Start hyperledger clsuter using compose.
Docker image with hyperledger fabric peer deployed.
The docker image is auto built at https://registry.hub.docker.com/u/yeasy/hyperledger-fabric-peer/.
FROM yeasy/hyperledger-fabric-peer:latest
The peer
command is the main command, you can use it as the start part.
E.g., see the supported sub commands with the help
command.
$ peer help
02:10:10.359 [crypto] main -> INFO 001 Log level recognized 'info', set to INFO
Usage:
peer [command]
Available Commands:
node node specific commands.
network network specific commands.
chaincode chaincode specific commands.
help Help about any command
Flags:
--logging-level="": Default logging level and overrides, see core.yaml for full syntax
Use "peer [command] --help" for more information about a command.
Hyperledger relies on a core.yaml
file, you can mount your local one by
$ docker run -v your_local_core.yaml:/go/src/github.com/hyperledger/fabric/peer/core.yaml -d yeasy/hyperledger-fabric-peer peer node start help
The storage will be under /var/hyperledger/
, which should be mounted from host for persistent requirement.
Your can also mapping the port outside using the -p
options.
- 7050: REST service listening port (Recommened to open at non-validating node)
- 7051: Peer service listening port
- 7052: CLI process use it for callbacks from chain code
- 7053: Event service on validating node
Start your docker daemon with
$ sudo docker daemon --api-cors-header="*" -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
Pull necessary images, notice the default config require a local built openblockchain/baseimage
. We can just use the yeasy/hyperledger
image instead.
$ docker pull yeasy/hyperledger:latest
$ docker tag yeasy/hyperledger:latest hyperledger/fabric-baseimage:latest
$ docker pull yeasy/hyperledger-fabric-peer:latest
Check the docker0
bridge ip, normally it should be 172.17.0.1
. This ip will be used as the CORE_VM_ENDPOINT=http://172.17.0.1:2375
.
$ ip addr show dev docker0
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:f2:90:57:cf brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:f2ff:fe90:57cf/64 scope link
valid_lft forever preferred_lft forever
Start a validating node.
$ docker run --name=vp0 \
--restart=unless-stopped \
-it \
-p 7050:7050 \
-p 7051:7051 \
-v /var/run/docker.sock:/var/run/docker.sock \
-e CORE_PEER_ID=vp0 \
-e CORE_PEER_ADDRESSAUTODETECT=true \
-e CORE_NOOPS_BLOCK_TIMEOUT=10 \
yeasy/hyperledger-fabric-peer:latest peer node start
Or use your docker daemon url.
$ docker run --name=vp0 \
--restart=unless-stopped \
-it \
-p 7050:7050 \
-p 7051:7051 \
-e CORE_PEER_ID=vp0 \
-e CORE_VM_ENDPOINT=http://172.17.0.1:2375 \
-e CORE_PEER_ADDRESSAUTODETECT=true \
-e CORE_NOOPS_BLOCK_TIMEOUT=10 \
yeasy/hyperledger-fabric-peer:latest peer node start
PBFT requires at least 4 nodes.
$ git clone https://github.com/yeasy/docker-compose-files
$ cd docker-compose-files/hyperledger
$ docker-compose up
More details, please refer to hyperledger-compose-files.
After the cluster starts up, enter into the container
$ docker exec -it vp0 bash
Inside the container, deploy a chaincode using
$ peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'
13:16:35.643 [crypto] main -> INFO 001 Log level recognized 'info', set to INFO
5844bc142dcc9e788785e026e22c855957b2c754c912702c58d997dedbc9a042f05d152f6db0fbd7810d95c1b880c210566c9de3093aae0ab76ad2d90e9cfaa5
Query a
's current value, which is 100.
$ peer chaincode query -n 5844bc142dcc9e788785e026e22c855957b2c754c912702c58d997dedbc9a042f05d152f6db0fbd7810d95c1b880c210566c9de3093aae0ab76ad2d90e9cfaa5 -c '{"Function": "query", "Args": ["a"]}'
13:20:07.952 [crypto] main -> INFO 001 Log level recognized 'info', set to INFO
100
Invoke a transaction of 10 from a
to b
.
$ peer chaincode invoke -n 5844bc142dcc9e788785e026e22c855957b2c754c912702c58d997dedbc9a042f05d152f6db0fbd7810d95c1b880c210566c9de3093aae0ab76ad2d90e9cfaa5 -c '{"Function": "invoke", "Args": ["a", "b", "10"]}'
13:20:31.028 [crypto] main -> INFO 001 Log level recognized 'info', set to INFO
ec3c675b-a2fe-4429-ab44-7f389e454657
Query a
's value now.
$ peer chaincode query -n 5844bc142dcc9e788785e026e22c855957b2c754c912702c58d997dedbc9a042f05d152f6db0fbd7810d95c1b880c210566c9de3093aae0ab76ad2d90e9cfaa5 -c '{"Function": "query", "Args": ["a"]}'
13:20:35.725 [crypto] main -> INFO 001 Log level recognized 'info', set to INFO
90
More examples, please refer to hyperledger-compose-files.
If you wanna manually start.
For root node:
docker run --name=node_vp0 \
-e CORE_PEER_ID=vp0 \
-e CORE_PBFT_GENERAL_N=4 \
--net="host" \
--restart=unless-stopped \
-it --rm \
-p 5500:7050 \
-p 7051:7051 \
-v /var/run/docker.sock:/var/run/docker.sock
-e CORE_LOGGING_LEVEL=debug \
-e CORE_PEER_ADDRESSAUTODETECT=true \
-e CORE_PEER_NETWORKID=dev \
-e CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft \
-e CORE_PBFT_GENERAL_MODE=classic \
-e CORE_PBFT_GENERAL_TIMEOUT_REQUEST=10s \
yeasy/hyperledger-fabric-peer:latest peer node start
for non-root node:
docker run --name=node_vpX \
-e CORE_PEER_ID=vpX \
-e CORE_PBFT_GENERAL_N=4 \
--net="host" \
--restart=unless-stopped \
--rm -it \
-p 7051:7051 \
--net="hyperledger_cluster_net_pbft" \
-e CORE_LOGGING_LEVEL=debug \
-e CORE_PEER_ADDRESSAUTODETECT=true \
-e CORE_PEER_NETWORKID=dev \
-e CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft \
-e CORE_PBFT_GENERAL_MODE=classic \
-e CORE_PBFT_GENERAL_TIMEOUT_REQUEST=10s \
-e CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 \
yeasy/hyperledger-fabric-peer:latest peer node start
The image is built based on Hyperledger Fabric Base image.
Install required libsnappy-dev, zlib1g-dev, libbz2-dev.
Install required rocksdb 4.1.
Install hyperledger fabric and build the peer
This image is officially supported on Docker version 1.7.0+.
Support for older versions (down to 1.0) is provided on a best-effort basis.
- N/A.
Be sure to familiarize yourself with the repository's README.md
file before attempting a pull request.
If you have any problems with or questions about this image, please contact us through a GitHub issue.
You can also reach many of the official image maintainers via the email.
You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.
Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.