node: failed to init L1: failed to get L1 RPC client: failed to dial L1 address
Hey guys, trying to set a fullnode on Ubuntu 22.04 and it’s been frustrating and confusing to say the least. The instructions don’t make clear at all what the different fields in the composer file even mean, and what are the clear boundaries between my L1 node and the BASE node.
The specific problem is, my base Docker node seems unable to connect to my L1 geth node at http://localhost:8545. I have verified that localhost:8545 is up and running and works as expected to send ETH transactions.
From .env.mainnet:
# [recommended] replace with your preferred L1 (Ethereum, not Base) node RPC URL:
OP_NODE_L1_ETH_RPC=http://localhost:8545
My docker-compose.yml:
version: '3.8'
services:
geth: # this is Optimism's geth client
build: .
ports:
# https://github.com/base-org/node/issues/79
- 8645:8545 # RPC - changed to avoid port conflict
# https://github.com/base-org/node/issues/79
- 8646:8546 # websocket - changed to avoid port conflict
- 36303:30303 # P2P TCP (currently unused) - changed to avoid port conflict
- 36303:30303/udp # P2P UDP (currently unused) - changed to avoid port conflict
- 7301:6060 # metrics
command: [ "bash", "./geth-entrypoint" ]
volumes:
- ${GETH_HOST_DATA_DIR}:/data
env_file:
# select your network here:
# - .env.sepolia
- .env.mainnet
node:
build: .
depends_on:
- geth
ports:
- 7545:8545 # RPC
- 9222:9222 # P2P TCP
- 9222:9222/udp # P2P UDP
- 7300:7300 # metrics
- 6060:6060 # pprof
command: [ "bash", "./op-node-entrypoint" ]
env_file:
# select your network here:
# - .env.sepolia
- .env.mainnet
It seems like the BASE node can’t connect to the world outside of the Docker container, i.e. it can’t “see” localhost:8545 from inside its container.
I tried this change to .env.mainnet, but it didn’t help:
OP_NODE_L1_ETH_RPC=http://host.docker.internal:8545
The exact log output of the error is:
node_1 | t=2024-03-26T15:41:58+0000 lvl=eror msg="Error initializing the rollup node" err="failed to init L1: failed to get L1 RPC client: failed to dial L1 address (http://host.docker.internal:8545): operation failed permanently after 10 attempts: address unavailable (http://host.docker.internal:8545)"
node_1 | t=2024-03-26T15:41:58+0000 lvl=crit msg="Application failed" message="failed to setup: unable to create the rollup node: failed to init L1: failed to get L1 RPC client: failed to dial L1 address (http://host.docker.internal:8545): operation failed permanently after 10 attempts: address unavailable (http://host.docker.internal:8545)"
base-fullnode_node_1 exited with code 1
About this issue
- Original URL
- State: closed
- Created 3 months ago
- Comments: 16 (4 by maintainers)
Thanks, but you did not address the issue of being unable to reach localhost:8545 (L1 geth node) from within the docker container; that’s all we’re talking about here for days and you have ignored that so far. Not trying to be provocative, just trying to steer the conversation to the actual problem.
When you said you were able to set BASE up successfully on a clean machine, you mean without a full Etherum geth runinng on the machine? So this is not at all what we are taking about. You did not detail how you connect to L1, which Ethereum RPC node (local or some paid external URL/service) and on which port. These details seem of the essence here.
99% of people who have an Etherum geth node already on the machine that they intend to install BASE on, have it running on 8545 and 8546. Since BASE is L2 it would be smart to give it a different set of ports by default, which is exactly what we’re trying to do by modifying the docker compose file.
Avoiding the port conflict seems to work but from inside docker it can’t reach the local L1 fullnode.
Unfortunately you did not comment at all about the real-world situation of an L1 geth node running on the same machine on ports 8545/8546 and how a BASE node can coexist with it, which I believe to be a very common use case.
Again, to drive home the point, and o can only find so many words to say the same thing: the only issue here is that the docker container can’t reach localhost:8545 (local geth Ethereum node as L1). Perhaps external RPC URLs work, but we need localhost:8545 to be reachable from within Docker.
I can imagine how busy you are, and we appreciate all you do here at no charge.
Thanks again.
Same here, trying to get this running with a local reth install. Would be helpful to have docs to show the right port setup. I assume they should be on the same network. Reth creates its own so just adjust the base docker-compose to use that network? At first I thought I had this set right, but when I start the geth/node docker-compose for base I get this error:
node-1 | t=2024-04-04T12:47:34+0000 lvl=eror msg="failed to fetch runtime config data" err="failed to fetch unsafe block signing address from system config: failed to fetch proof of storage slot 0x65a7ed542fb37fe237fdfbdd70b31598523fe5b32879e307bae27a0bd9581c08 at block 0x88d0a43196fede430dfeb10d1cf09a1782a8825fdfd9a6d79f036b34ba419e6d: eth_getProof is unimplemented for historical blocks"Agree easily working with a local node seems to be a very common use case that should be easy to get working.
exact same situation here.
I literally tried everything suggested here, docker-compose can’t “see” the host computer’s
localhost:8545:https://forums.docker.com/t/how-to-reach-localhost-on-host-from-docker-container/113321/15
In “normal” (non-composer) Docker you need to “expose” ports of the host computer explicitly to the Docker container. You can do so by adding
--expose=8545to thedockercommand line and thenhost.docker.internal:8545becomes an “alias” forlocalhost:8545.For sh*ts and giggles I added the docker-compose equivalent field
exposeto the .yml but still doesn’t help anything:Added this to both the
gethand thenodesection for good measure, but no luck, with or without quotes around8545.Same issue here, I also tried adding
extra_hosts: - "host.docker.internal:host-gateway"in the docker compose config but with no luck