Because the software (Docker fabric 0.6) and the system (Ubuntu 16.04TLS) operating environment version of the changing, so the online list of various tutorials or the personal summary of netizens may not be able to walk in their own environment, especially for the novice, out of the wrong. Fabric 1.0 is not going to be ready at the end of March, so share your summary of the kids ' shoes that you want to practice. There are many ways to build a test environment, and my newbie uses a relatively simple docker-based approach.
First of all, say something about my environment:
The host operating system is a 32-bit Windows7 WMware workstations 10
The virtual machine is installed in Ubuntu 16.04TLS (ps:32-bit host under the 64-bit Linux error, set on virtualization in the BIOS), to share the host network through NAT. IP Ens33 as shown in the following figure
1. Installing the configuration Docker
1.1 If you are not familiar with Docker suggestions, you can first look at "Docker Technology introduction and practice." Docker official to simplify the installation process, provide a set of installation scripts, Ubuntu and Debian system can use this set of script installation: Curl-ssl https://get.docker.com/| Sh
After executing this command, the script will automatically prepare everything and install Docker in the system. However, due to the Great Wall, the use of this script in the country may cause some downloads to appear in error situations. Some of the domestic cloud service providers have provided a modified version of the script to use the domestic Docker software source image installation, so as to avoid wall interference.
sudo apt-get remove Docker docker-engine
Curl-ssl Https://get.daocloud.io/docker | Sh
The above shows that the installation was successful, and if the average user needs to use the Docker command and needs to join the Docker group, then I will add the current user test.
sudo usermod-ag docker test
The next step is to modify the configuration of Docker DNS and The Mirror Accelerator (), which can sometimes be difficult to configure with a mirror accelerator at home. Many of the domestic cloud service providers have provided accelerator services. Alibaba Cloud Accelerator, Daocloud Accelerator, ling que cloud accelerator
Registering the user and applying for the accelerator will get an address such as https://jxus37ad.mirror.aliyuncs.com. We need to configure it to the Docker engine. Note that there are different types of Docker versions of different systems in the location files
sudo vi/etc/systemd/system/multi-user.target.wants/docker.service
Modifying the value of a Execstart
Execstart=/usr/bin/dockerd--dns 192.168.234.255-h=tcp://0.0.0.0:2375-h=unix:///var/run/docker.sock-- Registry-mirror=https://jxus37ad.mirror.aliyuncs.com
Next, Reload and turn on Docker
sudo systemctl daemon-reload
sudo systemctl restart Docker
When it's open, we can confirm.
sudo ps-ef | grep docker
sudo netstat-anp | grep 2375
sudo netstat-a | grep docker.sock
We can verify the entire installation with a helloworld example.
sudo Docker run Hello-world
Docker Images
Docker ps-a
Install Docker-compose First, install the PYTHON-PIP package
sudo aptitude install Python-pip
sudo pip install docker-compose>=1.8.0
Download Fabric 0.6 Image
Docker pull YEASY/HYPERLEDGER-FABRIC:0.6-DP \
&& docker pull YEASY/HYPERLEDGER-FABRIC-PEER:0.6-DP \
&& Docker pull YEASY/HYPERLEDGER-FABRIC-BASE:0.6-DP \
&& Docker pull Yeasy/blockchain-explorer: Latest \
&& docker tag yeasy/hyperledger-fabric-peer:0.6-dp hyperledger/fabric-peer \
&& Docker tag YEASY/HYPERLEDGER-FABRIC-BASE:0.6-DP hyperledger/fabric-baseimage \
&& docker tag yeasy/ HYPERLEDGER-FABRIC:0.6-DP HYPERLEDGER/FABRIC-MEMBERSRVC
Download Compose template files using PBFT mode
git clone https://github.com/yeasy/docker-compose-files
Download image
Docker pull Yeasy/hyperledger:latest
docker tag Yeasy/hyperledger:latest hyperledger/fabric-baseimage:latest
Docker pull Yeasy/hyperledger-peer:latest
Docker pull Yeasy/hyperledger-membersrvc:latest
Enter the Hyperledger project to start the PBFT cluster with member management
CD DOCKER-COMPOSE-FILES/HYPERLEDGER/0.6/PBFT
Docker-compose-f 4-peers-with-membersrvc.yml up
View
Docker exec-it pbft_vp0_1 bash
peer network login Jim
Password
6avzqlwcue9b
Deployment
Peer Chaincode deploy-u jim-p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02-c ' {"Function ":" Init "," Args ": [" a "," + "," B "," 200 "]} '
Transfer 10 RMB between accounts A and B
Peer Chaincode invoke-u jim-n ${cc_id}-C ' {"Function": "Invoke", "Args": ["a", "B", "10"]} '
If Baseimage does not have a latest version, you might encounter a throw exception here in query:
Ledgererror-resourcenotfound:ledger:resource not found