blockchainhyperledgerhyperledger-sawtooth

Sawtooth transaction processor not respond to the ping


I created a transaction processor using javascript sawtooth-sdk. When i run it locally, it works successfully and it gives me this message when running locally (By locally means running the javascript file using node index.js).

Connecting to Sawtooth validator at tcp://localhost:4004

Connected to tcp://localhost:4004

Registration of [myTP 1.0] succeeded

Then i dockerized it and when i start the container, it doesn't connect. It only has

Connecting to Sawtooth validator at tcp://localhost:4004

message. When i check the Sawtooth docker logs, there were no logs

My docker base image is FROM ubuntu:bionic and i expose EXPOSE 4004/tcp like this. What might be the problem? I know its coming from validator and what i cant understand is that this work locally and doesn't work in the docker file.


Solution

  • Looks like the application container and docker-compose containers are residing in 2 different networks.

    Find your network (probably this will be the name of the project directory)

    docker network ls

    Then connect the application container to the same network used by the compose

    docker network connect <network> <app container>

    If you need to do this in the start up of the app container,

    docker run -itd --network=<network name> <app image>

    Then, form the application, you can call the validator container name and connect,

    tcp://sawtooth-validator-default:4004