java-tron support containerized processes, we maintain a Docker image with latest version build from our master branch on DockerHub. To simplify the use of Docker and common docker commands, we also provide a shell script to help you better manage container services,this guide describes how to use the script tool.
Requires docker to be installed on the system. Docker version >=20.10.12.
Shell can be obtained from the java-tron project or independently, you can get the script from here or download via the wget:
$ wget https://raw.githubusercontent.com/tronprotocol/java-tron/develop/docker.sh
Get the tronprotocol/java-tron
image from the DockerHub, this image contains the full JDK environment and the host network configuration file, using the script for simple docker operations.
$ sh docker.sh --pull
Before running the java-tron service, make sure the necessary ports are opened:
8090
: providesHTTP
interface50051
: providesRPC
interface18888
: P2P service listening interface
then start the java-tron service with the --run
parameter
$ sh docker.sh --run
If you want to see the logs of the java-tron service, please use the --log
parameter
$ sh docker.sh --log | grep 'pushBlock'
If you want to stop the container of java-tron, you can execute
$ sh docker.sh --stop
If you do not want to use the default official image, you can also compile your own local image, first you need to change some parameters in the shell script to specify your own mirror info,DOCKER_REPOSITORY
is your repository name, DOCKER_IMAGES
is the image name,DOCKER_TARGET
is the version number, here is an example:
DOCKER_REPOSITORY="you_repository"
DOCKER_IMAGES="java-tron"
DOCKER_TARGET="1.0"
then execute the build:
$ sh docker.sh --build
Parameters for all functions:
-
--build
Building a local mirror image -
--pull
download a docker mirror from DockerHub -
--run
run the docker mirror -
--log
exporting the java-tron run log on the container -
--stop
stopping a running container -
--rm
remove container,only deletes the container, not the image, theconfig
andoutput-directory
directories.