<
 
 
 
 
×
>
hide You are viewing an archived web page, collected at the request of Ethereum Foundation using Archive-It. This page was captured on 15:40:06 Jun 22, 2021 , and is part of the Community collection. The information on this web page may be out of date. See All versions of this archived page. Loading media information

Geth, Docker and private testnet

Here is a set up I have been working on and am having issues with ability to create a private network with peers.
Basic set up: Used the dockerfile from https://github.com/ethereum/ethereum-dockers/tree/master/go-ethereum-base, and added a line for installation of ethereum to the image.
1. Upon creation of the image, I ran 2 instances of the image, (note that both contain basic custom genesis json file)
docker run -it -p 127.0.0.1:30303:30303 -p 3001:3001 --name e1
docker run -it -p 127.0.0.1:30304:30304 -p 3002:3002 --name e2 --link e1:e1
2. Next, I attached to the container, e1 and ran the following command:
geth --identity "ethnode1" --datadir "/tempdatadir1" --rpc --port "30303" --rpccorsdomain "*" --rpcport "3001" --genesis genesis.json --networkid 6161 --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --nat "any" --maxpeers 2 console
This launched a geth console, wherein I am able to check the node info using commands such as admin.nodeInfo, etc. Extracted the enode value for connecting the second node: "enode://@[::]:30303"
Exit console using crtl-c
3. Attached to the container e2, and ran the following command:
geth --identity "ethnode2" --datadir "/tempdatadir2" --rpc --port "30304" --rpccorsdomain "*" --rpcport "3002" --genesis genesis.json --networkid 6161 --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --nat "any" --maxpeers 2 console
This launched a geth console, wherein I am able to check the node info using commands such as admin.nodeInfo, etc. At this point, I tried adding the first node using the following command: admin.addPeer("enode://@127.0.0.1:30303"), which returns true.
However, when I try to list the peers using either admin.Peers, I see an empty array and using net.peerCount gives 0.

Suggestions, as to how the connectivity between the two can be enabled?
- Is it that the wrong IP address is being used? In general, is it possible to utilize a specific IP address from the host by forwarding the IP Address appropriately.
- Should the console not be exited in Step 2 above?
- In either of the above cases, how do we connect to an existing geth instance? I tried using geth attach "http://127.0.0.1:3001", but it gave me an error saying, connection refused. Any suggestions as to how we can attach to an existing geth instance?

Comments

Sign In or Register to comment.