Join Org4 to the Channel

Copy all files necessary files: org4-artifacts and channel_artifacts files to the server4/fabric-samples directory

Inside the org4-artifacts directory open a new terminal to set container for org4 peers and CLI:

docker-compose -f server4-cli.yaml up -d 

Run CLI container:

docker exec -it org4cli bash

Export the two key environment variables: ORDERER_CA and CHANNEL_NAME:

export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem && export CHANNEL_NAME=mychannel

To retieve mychannel genesis block:

peer channel fetch 0 mychannel.block -o orderer.example.com:7050 -c $CHANNEL_NAME --tls --cafile $ORDERER_CA  

Join peer into mychannel block:

peer channel join -b mychannel.block

For adding second peer of org4:

export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org4.example.com/peers/peer1.org4.example.com/tls/ca.crt && export CORE_PEER_ADDRESS=peer1.org4.example.com:14051 peer channel join -b mychannel.block