This setup assumes some basic knowledge about using Docker. Using Docker is the recommended way to run an Aergo node as it requires minimal configuration and enables you to use Docker features such as logging and restart policies.
When you run the Docker image named aergo/node for the first time, Docker downloads the latest image automatically.
To update the image to the latest version, run
docker pull aergo/node.
You can also specify a specific version by replacing
aergo/node with, for example,
Refer to Docker Hub to see a list of available tags.
This is the main command to run a node syncing with the main Aergo network:
docker run -v $(pwd)/data:/aergo/data -p 7845:7845 -p 7846:7846 aergo/node
-p argument maps ports from the aergo server inside the container to your host machine.
7846 is for the peer to peer protocol.
7845 is for the RPC API for connecting clients to the server; you can remove this port binding to disallow access to the API.
When running this command for the first time, it will create the default genesis block (block number 0). Afterwards it automatically starts synchronizing.
If your machine is behind a NAT (such as a router), you need to setup manual forwarding of the port 7846 to allow other peers to sync with your node.
To sync with the testnet instead, use the testnet flag:
docker run -v $(pwd)/data:/aergo/data -p 7845:7845 -p 7846:7846 aergo/node aergosvr --home /aergo --testnet
The above commands use default configuration files suitable to connect to officially supported networks. If you want to override configuration parameters, you can supply a custom config file using a Docker volume, for example:
docker run -v $(pwd)/data:/aergo/data -v $(pwd)/config.toml:/aergo/config.toml -p 7846:7846 aergo/node aergosvr --home /aergo --config /aergo/config.toml
Please refer to Configuration for a detailed explanation of the available settings.
To customize the log format, place an arglog.toml file in the container’s working directory:
Server key file¶
Every node is identified by a key and peer id. In the default configuration, a key is generated every time you launch the docker container.
This may not be what you want.
You can persist the generated key by adding a volume
You can also supply the key manually by placing aergo-peer.key and aergo-peer.id files in that volume.
Refer to Configuration for details about server keys.
Instead of binding several volumes, you can use one combined volume, e.g.
Without any specific settings, the server connects to Polaris, registers itself, obtains addresses of other nodes, and automatically attempts to connect to those nodes. If the server is in a NAT environment or has multiple NICs, additional settings are required for external nodes to access the server. You have to setup the external address in the external network connection and set the internal address for binding address.
netprotocoladdr = "18.104.22.168" # external address to which other peer can connect netprotocolport = 7846 npbindaddr = "192.168.0.2" # no config element or empty string means using same address as external npbindport = 17846 # negative number means it is same as external port, in this case 7846