Using Docker

Running a Docker Relay Node

  • 4GB RAM
  • 40GB SSD
  • 2 Cores

ARK Nodes execute many query intensive operations. The most cost-effective approach for running a high-performance node is choosing SSD over HDD. Increasing the total RAM improves cache performance.

TIP

Prerequisites to be installed:

TL;DR

Install Docker Community Edition

On a fresh OS installation, follow these steps:

Install Docker CE - Ubuntu / Debian

  • Preferably use latest stable OS version!
  1. Uninstall old versions:
sudo apt-get remove docker docker-engine docker.io containerd runc
  1. Install prerequisites:
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
  1. Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/$(grep "^ID=" /etc/os-release | cut -d\= -f2)/gpg | sudo apt-key add -
  1. Add Docker's official repository:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(grep "^ID=" /etc/os-release | cut -d\= -f2) $(lsb_release -cs) stable"
  1. Install Docker CE:
sudo apt-get update && sudo apt-get install -y docker-ce docker-ce-cli containerd.io
  1. Make Docker usage as a non-root user possible:
sudo usermod -aG docker ${USER}

WARNING

You'll have to logout and login again or just open another session in order to activate the last step.

Install Docker CE - CentOS

  • Preferably use latest stable OS version!
  1. Uninstall old versions:
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
  1. Install prerequisites:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
  1. Add Docker's official repository:
sudo yum-config-manager --add-repo  https://download.docker.com/linux/centos/docker-ce.repo
  1. Install Docker CE:
sudo yum install docker-ce docker-ce-cli containerd.io
  1. Start Docker CE:
sudo systemctl start docker && sudo systemctl enable docker
  1. Make Docker usage as a non-root user possible:
sudo usermod -aG docker ${USER}

WARNING

You'll have to logout and login again or just open another session in order to activate the last step.

Install Docker Compose

Docker Compose Install (Ubuntu / Debian / CentOS Latest Stable Releases)

 sudo curl -sL "https://github.com/docker/compose/releases/download/`curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest | sed 's#.*tag/##g' && echo`/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose

Using Official ARK Core Docker Image

Getting the Needed Files

mkdir mainnet &&
cd mainnet &&
curl -sOJ https://raw.githubusercontent.com/ARKEcosystem/core/master/docker/production/mainnet/docker-compose.yml &&
curl -sOJ https://raw.githubusercontent.com/ARKEcosystem/core/master/docker/production/mainnet/mainnet.env

Running the Node

WARNING

For normal Node operation, make sure TCP port 4001 is accessible from outside.

  • If you prefer ARK Core settings other than defaults, please make your changes prior running the Core (file=mainnet.env)

Starting the Relay

docker-compose up -d

TIP

If you prefer to use custom DB Name, DB User and DB Password simply adjust variables POSTGRES_PASSWORD, POSTGRES_USER, POSTGRES_DB (file=docker-compose.yml) and CORE_DB_PASSWORD, CORE_DB_USERNAME and CORE_DB_DATABASE (file=mainnet.env) correspondingly.

  • In case you want to use a remote PostgreSQL server simply adjust variable CORE_DB_HOST in your mainnet.env and run only Core container:
docker-compose up -d core

Troubleshooting

  • Make sure your containers are up and running:
docker ps -a --format "table {{.Names}}\t{{.Status}}"

You should see something similar to:

NAMES               STATUS
core-mainnet        Up 4 minutes
postgres-mainnet    Up 4 minutes
  • If some of the containers status is not Up, check docker logs:
docker logs core-mainnet
docker logs postgres-mainnet

Maintenance

Monitoring Relay Logs:

docker exec -it core-mainnet pm2 logs

Update

Docker live updates are now possible with CLI

  • As a preliminary step, installation of development tools is necessary (only needed once, when doing initial update):
docker exec -it core-mainnet sudo apk add make gcc g++ git python
  • We are all set! Run the update and follow instructions:
docker exec -it core-mainnet ark update

TIP

Updates and all changes made to the containers are kept even on container or host restart.

FAQ

How Do I Start With Empty DB?

Just execute the following code:

docker-compose down -v
docker-compose up -d

How Do I Start Everything from Scratch?

Just stop and trash all containers and images:

docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images -q)
docker volume prune -f
docker network prune -f