Running Iroha Instance using docker-compose

Gino Busok Jr
2 min readMar 7, 2021

If you want to run a single Iroha instance for you development needs, Iroha provided a very detailed document. You can find it here https://iroha.readthedocs.io/en/master/deploy/single.html. Just follow that and you should be good to go. But if you want an easier way then read on.

First you need to clone this https://github.com/hyperledger/iroha.git Once cloned, go to example directory. Then you will need to copy these files into a directory inside your working directory, which we will call IROHA_DATA

  • admin@test.priv
  • admin@test.pub
  • config.docker
  • genesis.block
  • node0.priv
  • node0.pub

Then I created this docker-compose file that will create your own development instance with a single docker-compose command.

Environment Variables

Database Variables

For database variables, check the value of pg_opt inside config.docker. Format should be like this

”pg_opt” : “host=db port=5432 user=postgres password=password”,

  • POSTGRES_USER Username of postgres db. This should be the same as the value of user
  • POSTGRES_PASSWORD Password of postgres db. This should be the same as the value of password
  • PG_PORT_CONTAINER Port of postgres db to connect to.

Iroha Variables

  • IROHA_PORT_HOST Port of Host to expose.
  • IROHA_PORT_CONTAINER Container port to be exposed to IROHA_PORT_HOST. This value should be the same as the value of torii_port inside config.docker.
  • IROHA_KEY this will be the name of your instance. Make sure this is the same as the name of node0.priv and node0.pub. So if you set this to node-0 make sure to rename both files to node-0.priv and node-0.pub
  • VOL_CONFIG_DATA the absolute or relative path where IROHA_DATA is located. Since we are using docker-compose the path can be relative to the working directory

Put everything in a .env file then run your iroha instance!

> docker-compose up

That’s it! Check your docker container if they are indeed running

Quick Check

> docker exec -it <container_id> iroha-cli -account_name admin@test

Choose the following:

> 2. New Query

> 9. Get Account Information (get_acc) Then enter account ID admin@test

> 1. Send to Iroha peer (send) Just choose the default values

You should see all details for admin@test like this

--

--