Using Docker (Testnet)

Prerequisites

Before starting, ensure that you meet the system requirements for Pharos nodes. Additionally, install the following dependencies:

Pharos Validator Node Deployment Steps

1. Create a working directory for your Pharos node:

docker stop pharos-testnet && docker rm pharos-testnet
export WORKSPACE=testnet
# If you want to keep the existing snapshot, please save the public database first.
mv /data/$WORKSPACE/pharos-node/domain/light/data/public/ /data/
rm -rf /data/$WORKSPACE
mkdir -p /data/$WORKSPACE
cd /data/$WORKSPACE

You need to modify /data/$WORKSPACE and create the $WORKSPACE directory in a data disk with large space. For example, if your data disk is mounted in /app, then mkdir /app/$WORKSPACE

Generate a docker-compose.yml file for managing Pharos nodes

version: '3'

services:
  pharos:
    image: public.ecr.aws/k2g7b7g1/pharos/testnet:63b85b6b
    container_name: pharos-testnet
    volumes:
      - /data/$WORKSPACE:/data
    ports:
      - "18100:18100"
      - "18200:18200"
      - "19000:19000"
    restart: unless-stopped

Parameter Explanation

  • name pharos-testnet: Container name, customizable.

  • /data/$WORKSPACE:/data: Local mount directory, recommended to be set on a high-capacity disk.

public.ecr.aws/k2g7b7g1/pharos/testnet:xxxxxxxx: Pharos testnet image address.

In your mount directory there should be a list of files:

  • deploy.light.json: Pharos binary configuration template

  • domain.json: Pharos deployment configuration file

  • genesis.conf: The genesis config of the testnet you are connecting to

And the following directories:

  • pharos-node: Pharos deployment directory, Contains configuration files, binaries, logs, DB, etc.

  • pharos-node-client : Pharos client directory, used to do node management

  • resources : Node's keys directory, including consensus signing key and BLS key. Keep it safe

2. Start the Pharos node and run the following command in the $WORKSPACE directory:

docker-compose up -d (or `docker compose up` depends on your version)

3.⏳ Wait for Sync

Once the local node starts syncing and you can confirm block height is increasing (this may take up to 3 minutes — do not run docker stop or docker-compose down during this period):

curl 127.0.0.1:18100/ \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'

Optional Steps

If you want to restore the public data:

docker stop pharos-testnet
rm -rf /data/$WORKSPACE/pharos-node/domain/light/data/public/
mv /data/public /data/$WORKSPACE/pharos-node/domain/light/data/
docker-compose up -d

Other commands:

# Stop
docker-compose stop
# Restart
docker-compose restart
# Update to latest version
docker-compose pull
docker-compose down && docker-compose up -d

Last updated