How to: run node using docker image
alexplevako edited this page Oct 31, 2018
·
20 revisions
Read this docker installation guide.
~$ docker pull scorum/release:0.2.1.ddb5b8f
~$ docker run -d -t -i --name {local_image_name} -v {path_to_mount_dir}:/var/lib/scorumd -p {peer_port}:{image_peer_port} -p {rpc_port}:{image_rpc_port} {docker_hub_image}
where:
-
local_image_name
is name of docker image to use on your machine. For exampletest_node
. Parameter could be skipped. -
path_to_mount_dir
- any directory you will prefer. You should have read+write access to it. In that folder by default will be placed database (blockchain dir), log files (logs dir), p2p config files (p2p dir) and default config file (config.ini). -
peer_port
is port number opened on your machine for peers from the network. -
image_peer_port
isp2p-endpoint
port specified in config.ini. This port is used inside docker image. Default is2001
. -
rpc_port
is port number opened on your machine for clients from the network. -
image_rpc_port
isrpc-endpoint
port specified in config.ini. This port is used inside docker image. Default is8001
. -
docker_hub_image
is name of docker image on docker hub, example:scorum/release:0.2.1.ddb5b8f8
.
Example of docker run command for witness (low-memory) node:
~$ docker run -d -t -i --name test_node -v /home/user/nodes/mynode:/var/lib/scorumd -p 2001:2001 -p 8001:8001 scorum/release:0.2.1.ddb5b8f
Example of docker run command for rpc (full-memory) node:
~$ docker run -d -t -i --name test_node -e NODE="full" -v /home/user/nodes/mynode:/var/lib/scorumd -p 2001:2001 -p 8001:8001 scorum/release:0.2.1.ddb5b8f
Execute docker ps
command. You should see something like:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
887c4e22bc75 scorum/release:0.2.1.ddb5b8f "/bin/bash /usr/lo..." 6 days ago Up 6 days 0.0.0.0:2001->2001/tcp, 0.0.0.0:8001->8001/tcp test_node
Check node logs. You could use:
~$ less /home/user/nodes/mynode/loga/node.log
# or
~$ docker logs -f test_node
You should see similar log:
2018-08-13T09:30:00.045704 th_a application.cpp:164 reset_p2p_node ] Configured p2p node to listen on 0.0.0.0:2001
2018-08-13T09:30:00.045748 th_a application.cpp:169 reset_p2p_node ] head_block_id: 0000000000000000000000000000000000000000
2018-08-13T09:30:00.046840 th_a application.cpp:218 reset_websocket_serv ] Configured websocket rpc to listen on 0.0.0.0:8090
2018-08-13T09:30:00.047617 th_a main.cpp:168 main ] starting plugins
2018-08-13T09:30:00.053486 th_a main.cpp:172 operator() ] Started node on a chain with 0 blocks.