Before installing Docker, ensure your system meets the minimum requirements before installing the RSK node.
Docker Desktop provides an easy and fast way for running containerized applications on various operating systems.
For Mac OSX and Windows:
For Linux:
sudo
for all docker commands, by default. To avoid this additional steps are required.Ensure that docker is running by running the following command - it should run without any errors.
docker ps
More information about Docker install here.
To install an RSK node using Docker, download the RSKj Dockerfiles and supervisord.conf
from the artifacts repo
or pull the image from Docker Hub.
Inside the artifacts repo, you can choose which type of node you are going to install:
Dockerfile.MainNet
Dockerfile.TestNet
Dockerfile.RegTest
Build the container by running any of the following commands:
Note: The type of node to run is dependent on the node’s type installed in install RSKj using Docker.
docker build -t mainnet -f Dockerfile.MainNet .
docker build -t testnet -f Dockerfile.TestNet .
docker build -t regtest -f Dockerfile.RegTest .
When the build finishes, you should see an output similar to this:
RSK-Node % docker build -t mainnet -f Dockerfile.MainNet .
[+] Building 452.4s (12/12) FINISHED
=> [internal] load build definition from Dockerfile.MainNet
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Now you have a container ready to run RSK!
To run the container, you should execute:
docker run -p 5050:5050 rsksmart/rskj:latest
This will start a Mainnet node.
docker run -p 50505:50505 rsksmart/rskj:latest --testnet
docker run rsksmart/rskj:latest --regtest
To install the node using docker containers from Mac M1:
Pull rskj-standalone
docker image and run container from this image with the following command:
docker run rsksmart/rskj-standalone
It’s possible that you may need to enable experimental features of Docker if your version does not support BuildX plugin by default. In order to enable experimental features:
/etc/docker/daemon.json
to add the property experimental: true
.daemon.json
, just add the property experimental: true
at the top level of the json. Finally click on Apply and Restart
Build the container by running any of the following commands:
Note: The type of node to run is dependent on the node’s type installed ininstall RSKj using Docker.
docker buildx build --platform linux/amd64 -t mainnet -f Dockerfile.MainNet .
docker buildx build --platform linux/amd64 -t testnet -f Dockerfile.TestNet .
docker buildx build --platform linux/amd64 -t regtest -f Dockerfile.RegTest .
When the build finishes, you have a container ready to run RSK.
To run the container, you should execute:
docker run -p 5050:5050 rsksmart/rskj:latest
This will start a Mainnet node.
docker run -p 50505:50505 rsksmart/rskj:latest --testnet
docker run rsksmart/rskj:latest --regtest
Keep in mind that RSK’s blockchain is stored locally in the container. If you want to save it to a permanent storage, you can use a volume mount while starting the container as shown in the command below:
docker run -p 5050:5050 -v /path/to/my/storage:/var/lib/rsk/.rsk rsksmart/rskj:latest
In order to interact with the node’s JSON-RPC endpoint, you’ll need to expose it to the host:
docker run -p 5050:5050 -p 127.0.0.1:4444:4444 rsksmart/rskj:latest
Then, you could, for example, query the current block number with
curl -H "Content-type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","id":1}' http://127.0.0.1:4444/
Finally, you can provide a custom configuration to the node with:
docker run -p 5050:5050 -v /path/to/my/custom/node.conf:/etc/rsk/node.conf rsksmart/rskj:latest
Go to top