Running a Parity Docker Container with Custom Configuration

Running the Parity Ethereum Client as a Docker container with a custom configuration is a relatively simple task, that usually only requires mounting one or two files (depending whether a custom chain is also configured or not) to the container.
TL;DR
A GitHub repository with the complete example is available here:
To start, we’ll create two directories:
src
: will contain the configuration fileseng
: will contain the docker compose file
Generate Wallet
To generate a wallet, use whatever client you feel comfortable with, such as MyCrypto which has both an online and a desktop version.
You can also use something like Secure Password Generator to easily generate a password that meets the required complexity policy.
Chain Genesis File
Create a chain.json
file inside the src
directory. We won’t be using one of the predefined configurations (taken from here):
mainnet
(default) main Ethereum networkkovan
ortestnet
the fast Ethereum test networkropsten
the old Ethereum test networkclassic
Ethereum Classic networkclassic-testnet
original Morden testnet and current Ethereum Classic testnetexpanse
Expanse networkdev
a Private development chain to be used locally, submitted transactions are inserted into blocks instantly without the need to minemusicoin
Musicoin networkellaism
Ellaism networktobalaba
EWF Tobalaba network
Instead, we’ll use the dev
chain file found here and copy it’s content to our file, so we can customize it with the wallet address we generated.
Look for the accounts
section and add an entry at the end with the address of the generated wallet:
Configuration File
Next we create a config.toml
file, also inside the src
directory. Our configuration file will be very simple, just the base directory and the path to the chain.json
file:
For more complex configurations, considering using the Parity Config Generator, as it greatly simplifies the process of creating the configuration file by providing an explanation on the available options and possible values where relevant.
Docker Compose File
Our docker compose file (docker-compose.yml
), which will be created in the eng
directory, will have only one service defined for the purpose of this example, but can be extended with whichever container you may require. The service will be a Parity container (obviously) with the two configuration files mounted to the /home/parity/.local/share/io.parity.ethereum
directory with the ports 8545, 8546, 30303 and 30303/udp exposed. The end result should look like this:
Running The Container
Now the only thing left to do to run the container is execute docker-compose up
from the directory containing the YAML file, or docker-compose -f <path to YAML file> up
from any other path.