Skip to main content

Use Docker

You can use Docker to run Hyperledger Besu or Geth as a Linea node on the mainnet or testnet.

Important

The Besu Docker image does not run on Windows.

Prerequisites

Download and install Docker.

Run a Besu node

Step 1. Download configuration files

Download the configuration files for the relevant network (in ZIP format) and extract them. The configuration files include the network genesis file, Docker Compose file and Besu configuration file.

Download the mainnet besu-mainnet ZIP file.

Step 2. Update the Docker Compose file

In the docker-compose.yaml file, update the --p2p-host command to include your public IP address. For example:

--p2p-host=103.10.10.10
tip

You can use this page to find your public IP address.

Step 3. Start the Besu node

Open a terminal, in the directory containing the docker-compose.yml file, run docker-compose up.

It can take up to 20 minutes for the node to find peers. If it takes any longer than that, try restarting the node.

Troubleshoot peering issues

Refer to the Besu troubleshooting information for help if you experience peering issues.

Run a Geth node

Step 1. Download configuration files

Download the configuration files for the relevant network. Ensure that you download the files to the same directory.

Download the mainnet docker-compose.yml and genesis.json files.

Step 2. Start the Geth node

Open up a terminal where the both docker-compose.yml and genesis.json are located (they should be in the same directory) and run docker compose up

The node should now be running and looking for peers to sync.

Confirm the node is running

You can call the JSON-RPC API methods to confirm the node is running. For example, call eth_syncing to return the synchronization status. For example the starting, current, and highest block, or false if not synchronizing (or if the head of the chain has been reached).


curl localhost:8545 \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}'

You should get a result, similar to:

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"startingBlock": "0x0",
"currentBlock": "0x5d228",
"highestBlock": "0x3cedec"
}
}