Build and run Parity anywhere with Docker:

Pick a container

Docker containers for Parity are available via Docker Hub:

$ docker search parity/parity
NAME                        DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
parity/parity               Parity is Ethcore's initial fully-featured...   0
parity/rust                 Rust stable, beta and nightly for GitLab C...   0                    [OK]
parity/snapcraft            Docker image for build snap application (U...   0                    [OK]
parity/rust-arm             RUST for GitLab CI runner (ARM architecture)    0                    [OK]

To get a list of available versions, use curl and jq:

$ curl -sS ''  | jq '."results"[]["name"]' | sort

To get the latest beta release, run:

$ docker pull parity/parity:v1.7.0

Run container

To run Parity with an interactive pseudo-tty shell, run:

$ docker run -ti parity/parity:v1.7.0

Configure parity

Parity can be configured using either the CLI options or a config file. Should the CLI flags and the config file disagree about a setting, the CLI takes precedence. You can list all CLI options by running:

$ docker run parity/parity:v1.7.0 --help

For Docker specific options, please refer to the Docker documentation, or run docker --help or docker run --help.

Open ports

To publish Parity’s ports to the host machine, use the -p option:

$ docker run -ti -p 8180:8180 -p 8545:8545 -p 8546:8546 -p 30303:30303 -p 30303:30303/udp parity/parity:v1.7.0 --ui-interface all --jsonrpc-interface all

For example, this will expose the User Interface, the JSONRPC-API, and the listen port to the host. Now you can open Parity UI from the Docker host computer to access the Parity Wallet.

To enable external discovery where desired (for example for PoA sealing nodes), specify the external IP by appending the flag --nat extip:, where is to be replaced by your actual external IP of the host.

Pass arguments

To pass further operating options to Parity, simply append them to the docker run command:

$ docker run -ti parity/parity:v1.7.0 --no-ui --no-dapps --no-discovery

In this case, it disables the Wallet, the DApps Server, and discovery.

Config file

For more complex node configurations, a TOML config file can be created and attached to the docker container.

$ mkdir -p ~/.local/share/io.parity.ethereum/docker/
$ touch ~/.local/share/io.parity.ethereum/docker/config.toml

You can use the Config File Generator to configure your Parity node and save it on your host’s disk, i.e., at ~/.local/share/io.parity.ethereum/docker/config.toml. To mount the configuration, use the docker run -v option:

$ docker run -ti -v ~/.local/share/io.parity.ethereum/docker/:/root/.local/share/io.parity.ethereum/ parity/parity:v1.7.0 --config /root/.local/share/io.parity.ethereum/config.toml

This will mount ~/.local/share/io.parity.ethereum/docker/ of the host machine at /root/.local/share/io.parity.ethereum/ inside the docker container. Therefore, the config file will be available via --config /root/.local/share/io.parity.ethereum/config.toml.

Persistent data directory

In case you need to persist the blockchain files, keys etc., you should run the image with the --base-path option and then mount it, e.g.:

$ docker run -ti -v ~/.local/share/io.parity.ethereum/docker/:/root/.local/share/io.parity.ethereum/ parity/parity:v1.7.0 --base-path /root/.local/share/io.parity.ethereum/

This will expose the whole data dir to the host machine at ~/.local/share/io.parity.ethereum/docker/.

Run in background

To run a detached Parity instance, use docker run -d:

$ docker run -d parity/parity:v1.7.0

It will run Parity in background. docker ps shows the instance:

$ docker ps
CONTAINER ID        IMAGE                 COMMAND             CREATED             STATUS              PORTS                          NAMES
245f312f3f39        parity/parity:v1.7.0   "/parity/parity"    7 seconds ago       Up 6 seconds        8080/tcp, 8180/tcp, 8545/tcp   epic_pike

To attach the container, use docker attach:

$ docker attach --sig-proxy=false 245f312f3f39

Disabling the signal proxy allows to detach again with CTRL+C.

Parity Deploy Scripts

A Parity deployment script generator is available at paritytech/parity-deploy. It uses docker and docker-compose. On Ubuntu systems these will automatically be installed if not already present on the system.

Currently these scripts supports two types of chains, either instant sealing for development and authority round for proof of authority with multiple validators.

Prepare the node

Some examples of using the script are:

Launching Parity

Once the configuration is created you just need to run the docker-compose command to launch the machine or machines. This can be done via:

$ docker-compose up -d

You will then be able to see the logs by running:

$ docker-compose logs -f

In these logs you should see a token being generated to login to parity. Alternatively you can run the command:

$ docker-compose logs | grep token

Once you are logged into the web interface if you go to Add Accounts, then select the option recovery phrase and enter the account recovery phrase as password. You now have an account with lots of ether to send around.

More options

You can also include extra nodes (e.g. ethstats monitoring) by including the docker-compose configuration in include/docker-compose.yml. To add Ethstats monitoring you would need to include this in the file:

    image: buythewhale/ethstats_monitor
      - ./monitor/app.json:/home/ethnetintel/eth-net-intelligence-api/app.json:ro
    image: buythewhale/ethstats
      - ./dashboard/ws_secret.json:/eth-netstats/ws_secret.json:ro
      - 3001:3000

Further reading