Search code examples
dockermergeethereumgo-ethereum

Prysm node unable to connect Geth node


Environment: OS:ubuntu_18_04_64 Docker:Docker version 19.03.2, build 6a30dfc

Prysm: prysmaticlabs/prysm-beacon-chain:latest

Geth: ethereum/client-go:latest

Containers:

1. two containers are running on the same machine;
2. docker run -d -v /mnt/prysm:/data -p 4000:4000 -p 13000:13000 -p 12000:12000/udp --name beacon-node prysmaticlabs/prysm-beacon-chain --datadir=/data --jwt-secret=/data/jwtsecret --execution-endpoint=http://localhost:8551  --accept-terms-of-use=true;
3. docker run -d --name ethereum --restart always \
-p 8545:8545 -p 30303:30303 -p 8546:8546 -p 8551:8551 \
-v /mnt/blockchain_data/eth:/root/.ethereum ethereum/client-go \
--http --http.addr "0.0.0.0" --http.port 8545 --http.api "eth,personal,net,web3,db,txpool,ws" \
--ws --ws.addr "0.0.0.0" --ws.origins "*" --ws.port "8546" \
--authrpc.jwtsecret "/root/.ethereum/geth/jwtsecret" \
--syncmode=snap --cache=1024 --maxpeers=50

configurations: 1.JWT on both nodes; 2. based on Prysm official guide, port 8551 mapping on geth node; 3. test localhost:8551 via nc -z -v and the connection successful;

After running two containers:

  1. beacon node logs: time="2022-09-16 05:38:19" level=error msg="Could not connect to execution client endpoint" error="Post "http://localhost:8551": dial tcp 127.0.0.1:8551: connect: connection refused: Post "http://localhost:8551": dial tcp 127.0.0.1:8551: connect: connection refused" prefix=powchain;

Solution

  • After spending a bit of time and effort on trying a wide variety of ways to resolve this issue, the root reason behind it is the docker network in which the beacon node cannot communicate with get node via port 8551. Adopting the host mode network can resolve this issue but I have no idea why this is happening.