Upgrade & Migrate a node with Docker

Preparation

The private key of the original node must be exported first! ! !

Prepare the private key for importing the node account. Private key export tutorial, click here.

Stop the original node

If you are migrating a node, you can skip this step.

Stop and delete the original node:

$ docker rm -f starcoin-main

Delete the ipc file of the original node:

$ rm -rf /data/starcoin/main/starcoin.ipc

Update the latest docker image:

$ docker pull starcoin/starcoin

Start a new node

Unzip the downloaded compressed package to overwrite the file of the previous version.

Note:

  • If you don't need to start the mining pool, you can delete the last parameter: --stratum-address 0.0.0.0 --stratum-port 9880;

  • --net main: Specify the main network, the test network can write barnard;

# run a new node
$ sudo docker run --restart=always \
    --name starcoin-main \
    -d -p 9880:9880 \
    -v /data/starcoin/:/data/starcoin/ \
    starcoin/starcoin \
    /starcoin/starcoin \
    -n main \
    -d /data/starcoin \
    --disable-metrics true \
    --miner-thread 0 \
    --stratum-address 0.0.0.0 --stratum-port 9880

# View the node running status
$ docker ps -a

Import the private key and set it as the default account

Connect to the console (premise: the node is running):

$ docker exec -it starcoin-main /bin/bash

> /starcoin/starcoin --connect /data/starcoin/main/starcoin.ipc console

% account default

Check the default account on the new node:

account default

If the account is your own, it is over. If the account is wrong, please import the private key and set it as the default account.

Import private key:

% account import -i your_private_key

Set as default account:

% account default your_account

Last updated