Skip to content

Launch with AionR Docker Image

MiaoShi09 edited this page Jul 9, 2019 · 1 revision

AionR images are available at Docker Hub under aionnetwork/aionr

Image Info

  • The work directory of docker images is /aionr. The structure is the same as the executable package
  • The runing data is located at /root/.aion. Mounting a volume or binding a host space to this directory is recommended.
  • Default Command is launching AionR to connect to Mainnet
  • Expose Ports:
    • 30303 (P2P)
    • 8545 (RPC HTTP)
    • 8546 (RPC WebSocket)
    • 8547 (Wallet)
    • 8008 (Stratum)

Get the image:

Pull from Docker Hub:

docker pull aionnetwork/aionr:latest

Run Docker Container

docker run -p 30303:30303 -p 8545:8545 -p 8546:8546 -p 8547:8547 -p 8008:8008 aionnetwork/aionr:latest
  • Run container with custom/mastery network
docker run -p 30303:30303 -p 8545:8545 -p 8546:8546 -p 8547:8547 -p 8008:8008 aionnetwork/aionr:latest ./mastery.sh
  • To mount a volume or host directory to the Container
docker run -p 30303:30303 -p 8545:8545 -p 8546:8546 -p 8547:8547 -p 8008:8008 --mount src=/host/dir/path/or/volumn/name,dst=/container/dir/path aionnetwork/aionr:latest

For example:

  1. create a volume and mount it with aionr data directory:
docker create volume aionrdata

docker run -p 30303:30303 -p 8545:8545 -p 8546:8546 -p 8547:8547 -p 8008:8008 --mount type=volume,src=aionrdata,dst=/root/.aion aionnetwork/aionr:latest
  1. bind a host directory with aionr data directory:
# /host/location must be existed
docker run -p 30303:30303 -p 8545:8545 -p 8546:8546 -p 8547:8547 -p 8008:8008 --mount type=bind,src=/host/location,dst=/root/.aion aionnetwork/aionr:latest

# Or /host/location does not have to be existed
docker run -p 30303:30303 -p 8545:8545 -p 8546:8546 -p 8547:8547 -p 8008:8008 -v /host/location:/root/.aion aionnetworkdocker/aionr:latest
  1. use configurations in the host and store data in the same directory:
docker run -p 30303:30303 -p 8545:8545 -p 8546:8546 -p 8547:8547 -p 8008:8008 --mount type=bind,src=/host/mainnet/configuration/directory,dst=/aionr/mainnet aionnetwork/aionr:latest --base-path=mainnet/base

To check the structure of /root/.aion, go AionR Wiki page

Configure Kernel

configure Kernel in the docker container

After the container is running, users can edit the configuration of each network through docker exec

docker exec -it <container_name or hash> /bin/bash

Then edit [NETWORK]\[NETWORK].toml

configure Kernel in the host

In some cases, users want to use the configuration and genesis file in the host. Users can mount a host directory that contains [NETWORK].toml and [NETWORK].json.

docker run -p 30303:30303 -p 8545:8545 -p 8546:8546 -p 8547:8547 -p 8008:8008 \
--mount type=bind,src=/host/db,dst=/root/.aion \
--mount type=bind,src=/host/mainnet,dst=/aionr/mainnet \
aionnetwork/aionr:latest

If there is no configuration file and genesis file in the host,

  1. use docker cp to get the default configurations and genesis files from the docker container:
# 1. launch a container using aionnetwork/aionr:latest
docker run -d --name aionr aionnetwork/aionr:latest
# 2. cp the folders to the host
docker cp aionr:/aionr/mainnet /host/mainnet/directory
docker cp aionr:/aionr/mastery /host/mastery/directory
docker cp aionr:/aionr/custom /host/custom/directory
# 3. stop and remove the container
docker stop aionr
docker rm aionr
# 4. edit configuration on the host and launch the container again
docker run -p 30303:30303 -p 8545:8545 -p 8546:8546 -p 8547:8547 -p 8008:8008 \
--mount type=bind,src=/host/db,dst=/root/.aion \
--mount type=bind,src=/host/mainnet/directory,dst=/aionr/mainnet \
aionnetwork/aionr:latest
  1. Get the configurations in the executive package on Github
Clone this wiki locally