Creating a Custom Parity Docker Image
Creating a custom Parity Ethereum Client Docker image is done by writing a dockerfile script. To keep things a simple as possible, I’ll be…
Creating a custom Parity Ethereum Client Docker image is done by writing a dockerfile script. To keep things a simple as possible, I’ll be basing this article on my previous one, Running a Parity Docker Container with Custom Configuration.
TL;DR
A GitHub repository with the complete example is available here:
GitHub - ItayPodhajcer/parity-docker-custom-image
Contribute to ItayPodhajcer/parity-docker-custom-image development by creating an account on GitHub.
As in the previous article, we’ll have two directories:
src: will contain the configuration fileseng: will contain the dockerfile and a docker compose file for testing
I won’t go over generating a wallet, the chain.json and config.toml as they were already discussed in the previous article mentioned above.
The Dockerfile
We’ll start by creating a parity.dockerfile in our eng directory, and base our custom image on the official parity/parity image, so the file will start with:
FROM parity/parityNext we’ll copy the two configuration files:
COPY /src/chain.json /home/parity/.local/share/io.parity.ethereum/chain.jsonCOPY /src/config.toml /home/parity/.local/share/io.parity.ethereum/config.tomlNote: The paths used in the copy commands assume the docker build context will be set to the root directory
Lastly, we’ll updated the container execution command to use the configuration file we copied in the previous step:
CMD [" - config","/home/parity/.local/share/io.parity.ethereum/config.toml" ]The complete file should look like this:
FROM parity/parityCOPY /src/chain.json /home/parity/.local/share/io.parity.ethereum/chain.jsonCOPY /src/config.toml /home/parity/.local/share/io.parity.ethereum/config.tomlCMD ["--config","/home/parity/.local/share/io.parity.ethereum/config.toml" ]Testing The Build Script
Here you have two options, either use the updated docker-compose.yml file, which now uses the dockerfile instead of the parity/parity image:
parity: container_name: custom-parity image: parity-custom build: context: ../ dockerfile: eng/parity.dockerfileOr, use docker build to build the file:
docker build . -f eng/parity.dockerfile -t parity-customIn a “real world” scenario, we would have pushed out custom image to a repository, so it could be used by other team members or other people in general.