Docker setup

This document describes how to run Lisk Core as a Docker image-based container. Lisk Core version 3 does not have any external dependencies, and hence does not require using docker-compose.

Pre-installation

Create a new user lisk

adduser lisk

Add the lisk user to the sudo user group:

sudo usermod -aG sudo lisk

Install Docker

To run Lisk Core in Docker, firstly it is necessary to install the Docker engine. Determine if your platform can run Docker as described below.

  • Ubuntu

  • MacOS

  • Windows

Configure Docker, in order that it can be run without sudo rights: linux post install

Install make using your package manager. For example, use apt-get if running Ubuntu as shown below:

sudo apt-get install curl make

Please refer to Docker installation for Mac. Install make using XCode.

Lisk Core download

git clone https://github.com/LiskHQ/lisk-core.git (1)
cd lisk-core/docker                  (2)
git checkout v3.1.1 -b v3.1.1 (3)
1 Clone the repository.
2 Navigate into the lisk-core root folder.
3 Check out the latest release tag.
Please check for the latest release in the Lisk Core releases list.

Run

Podman

podman can be used. Simply replace occurrences of docker with podman or alias docker=podman.

Create a "lisk-core" container:

  • Mainnet

  • Testnet

docker run --volume lisk-data:/home/lisk/.lisk \
           --publish 5001:5001 \
           --name lisk-core \
           lisk/core:3.1.1 \
             start --network=mainnet

The default log levels for Mainnet are:

"logger": {
    "fileLogLevel": "error",
    "consoleLogLevel": "none"
},

So if you start the node, it won’t show any logs in the console. This is the recommended setting for reducing the number of logs for a running node. However, to verify that the node started correctly, update the log levels in the config to info or lower.

Alternatively, start the node with the following flag:

start --network mainnet --console-log=info

See the Managing logs guide for more information about logging.

docker run --volume lisk-data:/home/lisk/.lisk \
           --publish 5001:5001 \
           --name lisk-core \
           lisk/core:3.1.1 \
             start --network=testnet

Configuration

Further parameters can be passed after --network, for example, as shown below:

docker run --volume lisk-data:/home/lisk/.lisk \
           --publish 5001:5001 \
           --publish 127.0.0.1:5000:5000 \
           --name lisk-core \
           lisk/core:3.1.1 \
             start --network=testnet --enable-http-api-plugin

Environment variables can be set with --env:

docker run --volume lisk-data:/home/lisk/.lisk \
           --publish 5001:5001 \
           --env LISK_CONSOLE_LOG_LEVEL=debug \
           --name lisk-core \
           lisk/core:3.1.1 \
             start --network=testnet

See the Configuration guide for a reference of more configuration options.

An example with all possible flags set is shown below:

docker run -d --volume /data:/home/lisk/.lisk \
    --publish 7000:7000 --publish 8080:8080 --publish 7008:7008\
    --name lisk-core lisk/core:3.1.1 start --network=testnet --port 7000\
    --api-ws --enable-http-api-plugin --http-api-plugin-port 7008\
    --http-api-plugin-host host.docker.internal --http-api-plugin-whitelist 0.0.0.0/0 \
    --api-ws --api-ws-port 8080 --api-ws-host 0.0.0.0

Import blockchain snapshot

docker run --volume lisk-data:/home/lisk/.lisk -it --rm lisk/core:3.1.1 blockchain:download --network=betanet --output=/home/lisk/.lisk/tmp/
docker run --volume lisk-data:/home/lisk/.lisk -it --rm lisk/core:3.1.1 blockchain:import /home/lisk/.lisk/tmp/blockchain.db.tar.gz
docker run --volume lisk-data:/home/lisk/.lisk -it --rm --entrypoint rm lisk/core:3.1.1 -f /home/lisk/.lisk/tmp/blockchain.db.tar.gz
docker start lisk-core
docker logs -f lisk-core