Starting the node using docker-compose
Table of Contents
Introduction
You can also start your node using docker-compose
, which is even easier than starting your node using conventional Docker commands described here.
Setting up the environment
You need to have docker-compose
package installed on your machine. If you don't have this package installed, run the following command in terminal for:
root
user:
apt-get -y install docker-compose
- Normal user:
sudo apt-get -y install docker-compose
Attention
By implementing this way of starting the node we assume that
node.config
,genesis.txt
,- SSL keys,
db
andlog
directories
are present and stored in /opt/thepower/
like described in Docker and source manuals.
The following tree describes the directories and files in them:
hostname
here is an example. Please, replace it with the hostname specified in your node.config
file.
- Go to
/opt/thepower
:
cd /opt/thepower
- Create
docker-compose.yml
file with the following code:
docker-compose.yml
version: "3.3"
services:
tpnode:
restart: unless-stopped
container_name: tpnode
image: thepowerio/tpnode
volumes:
- type: bind
source: /opt/thepower/node.config
target: /opt/thepower/node.config
read_only: true
- type: bind
source: /opt/thepower/genesis.txt
target: /opt/thepower/genesis.txt
read_only: true
- type: bind
source: /opt/thepower/db
target: /opt/thepower/db
- type: bind
source: /opt/thepower/log
target: /opt/thepower/log
ports:
- 1080:1080
- 1443:1443
- 1800:1800
watchtower:
restart: unless-stopped
container_name: watchtower
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 3600 --cleanup
Note
This file also allows watchtower
to automatically update the node.
Starting the node
To start the node:
- Ensure, that you are in
/opt/thepower
directory. If not, run:
cd /opt/thepower
- Run the following command:
docker-compose up -d
Stopping the node
- Ensure, that you are in
/opt/thepower
directory. If not, run:
cd /opt/thepower
- Run the following command:
docker-compose down