M Zeeshan Haider
M Zeeshan Haider

Reputation: 1

Error while Confirming Connectivity to the REST API (for Docker) curl http://localhost:8008/blocks

I am trying to set up Hyperledger sawtooth testing node, so I followed this link: setting up a sawtooth testing node with Docker

I have started node by using this command: docker-compose -f sawtooth-default.yaml up and it running. running node view

now I need to Confirm Connectivity to the REST API (for Docker):

To confirm that the REST API and validator are running and reachable from the client container, I run this curl command: curl http://rest-api-0:8008/blocks and it works fine view output, but in the second step I need to check connectivity from the host computer, from a new terminal window on my host system I run this curl command: curl http://localhost:8008/blocks` and it gives this error view error :

curl:(7) Failed to connect to localhost port 8008: connection refused.

I am using the ubuntu 20.04 system, I have found some solution link, but that was on the AWS server which quoted this "On AWS doing a curl http://localhost:8008/blocks gives me an error message. I resolved the issue by changing the docker container ‘hosts’ file, use AWS ec2 private IP instead.

cd /etc
echo AWS PRIVATE IP ADDRESS localhost > hosts
root@99a2e75d41f6:/etc# echo 10.0.1.224 localhost > hosts
root@99a2e75d41f6:/etc# cat hosts
10.0.1.224 localhost

Please help me to resolve the issue.

Upvotes: 0

Views: 522

Answers (1)

uit_2018
uit_2018

Reputation: 23

i think you can use this command to get correct ip address of image docker inspect sawtooth-rest-api-default-0 | grep IPAddress then replace your url to the url from ip address you have just get from previous step. example http://172.20.0.11:8008/blocks

Upvotes: 0

Related Questions