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.shGet 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 --pullBefore running the java-tron service, make sure the necessary ports are opened:
8090: providesHTTPinterface50051: providesRPCinterface18888: P2P service listening interface
then start the java-tron service with the --run parameter
$ sh docker.sh --runIf 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 --stopIf 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 --buildParameters for all functions:
-
--buildBuilding a local mirror image -
--pulldownload a docker mirror from DockerHub -
--runrun the docker mirror -
--logexporting the java-tron run log on the container -
--stopstopping a running container -
--rmremove container,only deletes the container, not the image, theconfigandoutput-directorydirectories.