feat: add docker compose with docs (#3496)

Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
This commit is contained in:
Paolo Facchinetti
2023-07-03 15:04:17 +02:00
committed by GitHub
parent 770652a787
commit da58e39c26
7 changed files with 173 additions and 51 deletions

View File

@ -45,3 +45,74 @@ The build will likely take several minutes. Once it's built, test it with:
```bash
docker run reth:local --version
```
## Using the Docker image
There are two ways to use the Docker image:
1. [Using Docker](#using-plain-docker)
2. [Using Docker Compose](#using-docker-compose)
### Using Plain Docker
To run Reth with Docker, run:
```bash
docker run \
-v rethdata:/root/.local/share/reth/db \
-d \
-p 9000:9000 \
--name reth \
reth:local \
node \
--metrics 0.0.0.0:9000
```
The above command will create a container named `reth` and a named volume called `rethdata` for data persistence.
It will use the local image `reth:local`. If you want to use the GitHub Container Registry remote image, use `ghcr.io/paradigmxyz/reth` with your preferred tag.
### Using Docker Compose
To run Reth with Docker Compose, run the following command from a shell inside the root directory of this repository:
```bash
./etc/generate-jwt.sh
docker compose -f etc/docker-compose.yml up -d
```
To check if Reth is running correctly, run:
```bash
docker compose logs -f reth
```
The default `docker-compose.yml` file will create four containers:
- Reth
- Prometheus
- Grafana
- Lighthouse
Grafana will be exposed on `localhost:3000` and accessible via default credentials (username and password is `admin`)
## Interacting with Reth inside Docker
To interact with Reth you must first open a shell inside the Reth container by running:
```bash
docker exec -it reth bash
```
**If Reth is running with Docker Compose, replace `reth` with `reth-reth-1` in the above command**
### Listing the tables
```bash
reth db stats
```
### Viewing some records
```bash
reth db list --start=1 --len=2 Headers
```