Docker Management

TOP

Docker greatly simplifies node management. Below we will go over some of the best practices for managing your Docker Image.

Starting the Container

The following command will start the node container. Either set the specified environment variables (i.e. NANO_NAME=nano_node) or substitute in explicit values to the docker run command.


  • ${NANO_NAME} - The name that you would like to assign to the docker container.

  • ${NANO_TAG} - The version of docker image you will be running. For consumers, latest is acceptable, but for enterprise use, a manually set tag to the latest version number is recommended.

  • ${NANO_HOST_FOLDER} - Location on the host computer where the ledger, configuration files, and logs will be stored. The Docker container will directly store files such as config.json and data.ldb into this directory.


docker run --restart unless-stopped -d \
  -p 7075:7075/udp \
  -p 7075:7075 \
  -p 127.0.0.1:7076:7076 \
  -v ${NANO_HOST_FOLDER}:/root/RaiBlocks \
  --name ${NANO_NAME} \
  nanocurrency/nano:${NANO_TAG}

  • Providing -p 127.0.0.1:7076:7076 indicates that only RPC commands originating from the host will be accepted. Without the 127.0.0.1 (localhost) provided, anyone with access to your system's IP address can control your rai_node.

  • If you wish to use different ports, change the host ports in the docker run command; do not change the ports in rai_node's config.json.


This will start the docker container using host ports 7075 and 7076. Upon successful startup, docker will return the container's full ID. A typical ID will look something like the value below.

0118ad5b48489303aa9d195f8a45ddc74a90e8a7209fc67d5483aabf3170d619

TCP is used for bootstrapping and UDP is used to stream live transactions on the network. For more information, see the network specification documentation.

On port 7075, both TCP and UDP are required.

If you are running multiple rai_node docker containers, do not share the same ${NANO_HOST_FOLDER}, each rai_node requires its own independent files.

Stopping the Container

To stop your Nano Node:

sudo docker stop ${NANO_NAME}

Restarting the Container

If you need to restart your node for any reason:

sudo docker restart ${NANO_NAME}

Checking Container Status

A list of currently running containers can be found by issuing the following command.

sudo docker ps
CONTAINER ID        IMAGE               COMMAND                 CREATED             STATUS              PORTS                                                                      NAMES
0118ad5b4848        nanocurrency/nano   "/bin/bash /entry.sh"   41 seconds ago      Up 56 seconds       0.0.0.0:7075->7075/tcp, 0.0.0.0:7075->7075/udp, 127.0.0.1:7076->7076/tcp   nano_node_1

Updating the Docker Image

First, stop the container if it is running.

sudo docker stop ${NANO_NAME}

Then we can download the latest version with docker pull (or whichever version we need).

# Pulls latest release of the Nano Node
sudo docker pull nanocurrency/nano
# Pulls the Nano Node tagged with "V13.0" from Dockerhub
# See: https://hub.docker.com/r/nanocurrency/nano/tags/
sudo docker pull nanocurrency/nano:V13.0

Lastly, we start up the docker container using the same command docker run command.

Updating Node Configuration

First, stop the container if it is running.

sudo docker stop ${NANO_NAME}

Modifications made to config.json while the docker container is running may not properly save and cause unwanted side-effects.

You may now edit the config.json file located in ${NANO_HOST_FOLDER} using your preferred text editor.

Once modifications are complete, start the docker container using the same command docker run command.