For the best viewing experience, please turn your phone to portrait mode.

Lisk Core Docker Administration

This section details how to work with a Docker based Lisk Core installation.
Listed below are available basic commands which can be used to manage your Docker based Lisk node.
For more details, see each commands reference below.
A brief summary of all commands and associated flags has been provided for advanced users.

Basic Commands

Note

Below commands must be executed inside the docker directory of your Lisk Core installation.

Status

docker-compose ps

Start

docker-compose start lisk

Stop

docker-compose stop lisk

Restart

docker-compose restart lisk

Reset / Coldstart

make coldstart

Logs

docker-compose logs

Configuration

Lisk Core normally gets configured by providing a suited configuration file.
But this isn't convenient in a Docker installation.
Instead, one can use environment variables to change values in the configuration.
To do so, open the .env file, that you created during docker installation, and adjust the values to your needs.
All names of the environment variables start with ENV_ prefix.

Advanced configuration

For advanced configuration, open docker/docker-compose.override.yml.
Configuration variables always start with LISK_ and are mapped to their path in config.json.
These can be changed directly in the file, if needed.
For example, the value of redis.db.host can be changed by setting the LISK_REDIS_DB_HOST environment variable.
If you are unsure what variable name to use, refer to the list of command line options.

After editing the variables, reinitialize Lisk Core. It will read docker-compose.yml and your customized docker-compose.override.yml file:

docker-compose up -d

Examples

Use redis for caching

Caching using redis can be enabled with the docker-compose.redis.yml file, e.g.:

Note

When specifying additional docker-compose files like docker-compose.redis.yml, they need to be chained in the correct order by using the -f flag like below:

docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.redis.yml up -d

Note that the variables inside docker-compose.redis.yml can be defined in docker-compose.override.yml as well.

Do not expose ports:

(see https://docs.docker.com/compose/compose-file/#ports)

version: "3"
services:

  lisk:
    ports:
      - ${ENV_LISK_HTTP_PORT}
      - ${ENV_LISK_WS_PORT}

Increase log level to debug, enable public API:

(see https://docs.docker.com/compose/compose-file/#environment)

version: "3"
services:

  lisk:
    environment:
      - LISK_CONSOLE_LOG_LEVEL=debug
      - LISK_API_PUBLIC=true

Add forging delegates and whitelist IPs:

(see https://docs.docker.com/compose/compose-file/#environment)

version: "3"
services:

  lisk:
    environment:
      - LISK_FORGING_DELEGATES=publicKey1|encryptedPassphrase1,publicKey2|encryptedPassphrase2
      - LISK_API_WHITELIST=127.0.0.1,172.17.0.1
      - LISK_FORGING_WHITELIST=127.0.0.1,172.17.0.1

Sync from snapshot

Syncing from genesis can take a lot of time as the whole blockchain needs to be downloaded and validated.
To accelerate this process, it is recommended to sync your node from a snapshot.
Snapshots are database dumps of the Blockchain on a certain blockheight. While syncing from a snapshot, your node will only validate blocks with heigher blockheight than the one of the used snapshot.

Note

Lisk provides official snapshots that will be used during automated synching process. If you want to use third-party snapshots make sure they come from a reliable source.

Automated

cd lisk/docker  # navigate into docker directory
make coldstart  # will download and restore a blockchain snapshot for you

Manually

The command block in the example below will perform the process. The URL can be substituted for another blockchain.db.gz snapshot file if desired.

Example

For this example we expect the environment variables equal the following values:

  • ENV_LISK_NETWORK=mainnet
  • ENV_LISK_DB_DATABASE=lisk
cd lisk/docker            # navigate into docker directory
curl --output main_blockchain.db.gz https://downloads.lisk.io/lisk/main/blockchain.db.gz  # download and save the blockchain snapshot
docker-compose up -d      # initialize Lisk and postgreSQL
docker-compose stop lisk  # stop Lisk Core
docker-compose start db   # start postgreSQL
docker-compose -f docker-compose.yml -f docker-compose.make.yml run --rm db-task dropdb --if-exists lisk # drop old database
docker-compose -f docker-compose.yml -f docker-compose.make.yml run --rm db-task createdb lisk           # create fresh database
gzip --decompress --to-stdout main_blockchain.db.gz | docker-compose -f docker-compose.yml -f docker-compose.make.yml run --rm db-task psql >/dev/null # import snapshot into database
docker-compose start lisk # start Lisk container

What's next?
Source