title: Unable to join peers to channel in Hyperledger First Network setup
body: <p>I am following a tutorial on <a href="https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html" rel="nofollow noreferrer">the Hyperledger fabric site</a> and after installing all the perquisites (latest versions) on a Linux 18.04 installation I run into an error.</p>
  
  <p>I am trying to run the given ./byfn script to "Build Your First Network". After a fresh install I run the commands as follows:</p>
  
  <pre><code>./byfn generate
  ./byfn up
  </code></pre>
  
  <p>At which point everything performs as expected untill the following error occurs 5 times in a row (after which the run exits with an Error):</p>
  
  <pre><code>+ peer channel join -b mychannel.block
  + res=1
  + set +x
  Error: error getting endorser client for channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: context deadline exceeded
  peer0.org1 failed to join the channel, Retry after 3 seconds
  </code></pre>
  
  <p>I have tried various things like:</p>
  
  <ul>
  <li>Increasing the timeout to allow for longer connection times</li>
  <li>I have down-ed the network and upped it again</li>
  <li>Full re-installations of required packages and the fabric-samples</li>
  <li>Removed all docker volumes/images/containers</li>
  </ul>
  
  <p>I came across some sources mentioning that it might have to do with the peers not being able to connect to each other. Which I tried to fix with a manual docker connect of each peer to the byfn docker network, no success there. I can see the orderer running but the peers that attempted to join the network exited with an error:</p>
  
  <pre><code>docker container ls -a
  CONTAINER ID        IMAGE                               COMMAND             CREATED             STATUS                      PORTS                    NAMES
  99570e191542        hyperledger/fabric-tools:latest     "/bin/bash"         24 seconds ago      Up 23 seconds                                        cli
  340d1225a913        hyperledger/fabric-peer:latest      "peer node start"   30 seconds ago      Exited (2) 24 seconds ago                            peer0.org1.example.com
  fabe017751a0        hyperledger/fabric-peer:latest      "peer node start"   30 seconds ago      Exited (2) 25 seconds ago                            peer1.org2.example.com
  f81a639f29f6        hyperledger/fabric-peer:latest      "peer node start"   30 seconds ago      Exited (2) 26 seconds ago                            peer1.org1.example.com
  0f91080db681        hyperledger/fabric-peer:latest      "peer node start"   30 seconds ago      Exited (2) 27 seconds ago                            peer0.org2.example.com
  c491adc91320        hyperledger/fabric-orderer:latest   "orderer"           30 seconds ago      Up 28 seconds               0.0.0.0:7050-&gt;7050/tcp   orderer.example.com
  </code></pre>
  
  <p>This shows that the nodes exited with an error code, they all look the same, look below for a docker logs of the peer node.</p>
  
  <p>So my final question is: How do I get the "First Network" Hyperledger sample peers to successfully join the channel?</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Update 1</strong></p>
  
  <p>I chose a bad code dump! Please use these links for logs/outputs.</p>
  
  <ul>
  <li><a href="http://snippi.com/s/y0xii7p" rel="nofollow noreferrer">Full ./byfn up output</a></li>
  <li><a href="http://snippi.com/s/fhmoz5h" rel="nofollow noreferrer">Docker log output for peer0</a></li>
  </ul>
  
  <p><strong>Update 2</strong></p>
  
  <p>So I have been trying various things, it seems to not be a go related error but simply a "connection" error where go crashes upon trying to connect a peer to the channel. So the main question at hand is: Why are my docker instances not properly connecting to the channel?</p>
  
  <p><strong>Update 3</strong></p>
  
  <p>I have used Amazon Web Services to launch a Linux instance and re-created all my installation steps on this "fresh" instance. Everything worked on the first go (pun intended). Therefore I must conclude that it had to do with either my network settings or personal setup as these are the only parameters that changed.</p>
  
  <p>As this works for me for now I will work with that. I am still open to suggestions and will keep an eye on this post!</p>
  
  <p><strong>Package versions</strong></p>
  
  <ul>
  <li><p>Hyperledger Fabric 1.4.0</p></li>
  <li><p>Docker version 18.09.2, build 6247962</p></li>
  <li><p>docker-compose version 1.13.0, build 1719ceb</p></li>
  <li><p>go version go1.11 linux/amd64</p></li>
  <li><p>npm: '6.4.1',</p></li>
  <li><p>node -v: v8.15.0 </p></li>
  </ul>