Docker Installation

This page will guide you through Docker setup steps.

Install Docker

Install or update Docker to the latest version. Visit the Official Docker websitearrow-up-right for detailed instructions. Use the command below to find your installed version if needed:

docker --version

Docker and Security Best Practices

General best practices recommend against running the tBTC v2 client as the root user as a security precaution. One security-minded approach is to Run the Docker daemon as a non-root userarrow-up-right (Rootless mode).

Next, choose ONE of the following options. The tBTC v2 Service option configures the client to run as a service in order to ensure that the client is restarted automatically, should your machine reboot. The Docker Launch Script is faster to setup, but won't start the client if your machine reboots.

Create the tbtcv2.service file:

cd /etc/systemd/system/
nano tbtcv2.service

Paste the following in the tbtcv2.service file:

[Unit]
Description=tBTC v2 client
After=network.target
Wants=network.target

[Service]
Environment="ETHEREUM_WS_URL=<Ethereum API WS URL>"
Environment="OPERATOR_KEY_FILE_NAME=<Operator Account keyfile name>"
Environment="OPERATOR_KEY_FILE_PASSWORD=<Operator Account keyfile password>"
Environment="PUBLIC_IP=/dns4/<PUBLIC_IP_OF_MACHINE>/tcp/3919"
Environment="CONFIG_DIR=/home/<user name>/keep/config"
Environment="STORAGE_DIR=/home/<user name>/keep/storage"

# These items only apply if you setup rootless-mode.
# Do not enable unless using rootless mode. Don't forget to adjust user UID.
#Environment="XDG_RUNTIME_DIR=/run/<user name>/<user UID>/"
#Environment="DOCKER_HOST=unix:///run/<user name>/<user UID>/docker.sock"

Type=simple
WorkingDirectory=/home/<user>

ExecStart=/usr/bin/docker run \
    --volume ${CONFIG_DIR}:/mnt/keep/config \
    --volume ${STORAGE_DIR}:/mnt/keep/storage \
    --env KEEP_ETHEREUM_PASSWORD=${OPERATOR_KEY_FILE_PASSWORD} \
    --env LOG_LEVEL=info \
    --log-opt max-size=100m \
    --log-opt max-file=3 \
    -p 3919:3919 \
    -p 9601:9601 \
    keepnetwork/keep-client:latest \
    start \
    --ethereum.url ${ETHEREUM_WS_URL} \
    --ethereum.keyFile /mnt/keep/config/${OPERATOR_KEY_FILE_NAME} \
    --storage.dir /mnt/keep/storage \
    --network.announcedAddresses $PUBLIC_IP

Restart=always
RestartSec=15s

[Install]
WantedBy=default.target

Replace the placeholders inside the <> brackets, remove the <> brackets but be sure to not edit anything further.

When done, save and close the file.

Next, test to make sure your configuration works:

There will be no console output because it will be running in the background. Use systemctl to get the status of the service:

If the service failed, go back and double check your configuration.

Another option is to see if the Docker container is running:

If everything is running as intended, enable the service:

Now, with the service running, you should make sure that your configuration will tolerate a reboot and start up again automatically.

Log back in to your machine and check that the service is running. If it is, you're done. If not, go back and review your work.

triangle-exclamation

Client Startup

Unless the --detach flag was removed from the startup script, there will be no console output. In order to check your node, retrieve the Docker logs.

First, find your Docker instance identification, it'll be a random combination of words, e.g. stinky_brownie:

Use your specific identification and substitute:

Scroll down about half a page, and you should see the following:

Congratulations, your node is up and running.

Last updated

Was this helpful?