# Docker Compose
With Docker Compose, you can spin up local testnets with a single command.
# Requirements
# Build
Build the tendermint
binary and, optionally, the tendermint/localnode
docker image.
Note the binary will be mounted into the container so it can be updated without rebuilding the image.
# Run a testnet
To start a 4 node testnet run:
The nodes bind their RPC servers to ports 26657, 26660, 26662, and 26664 on the host.
This file creates a 4-node network using the localnode image.
The nodes of the network expose their P2P and RPC endpoints to the host machine on ports 26656-26657, 26659-26660, 26661-26662, and 26663-26664 respectively.
To update the binary, just rebuild it and restart the nodes:
# Configuration
The make localnet-start
creates files for a 4-node testnet in ./build
by
calling the tendermint testnet
command.
The ./build
directory is mounted to the /tendermint
mount point to attach
the binary and config files to the container.
To change the number of validators / non-validators change the localnet-start
Makefile target here:
The command now will generate config files for 5 validators and 3 non-validators. Along with generating new config files the docker-compose file needs to be edited. Adding 4 more nodes is required in order to fully utilize the config files that were generated.
Before running it, don't forget to cleanup the old files:
# Configuring ABCI containers
To use your own ABCI applications with 4-node setup edit the docker-compose.yaml (opens new window) file and add image to your ABCI application.
Override the command (opens new window) in each node to connect to it's ABCI.
Similarly do for node1, node2 and node3 then run testnet (opens new window)
# Logging
Log is saved under the attached volume, in the tendermint.log
file. If the
LOG
environment variable is set to stdout
at start, the log is not saved,
but printed on the screen.
# Special binaries
If you have multiple binaries with different names, you can specify which one
to run with the BINARY
environment variable. The path of the binary is relative
to the attached volume.