0

I am using using capegemini ethereum docker : https://github.com/Capgemini-AIE/ethereum-docker

  1. geth attach http://localhost:8545
  2. docker exec -it ethereum-docker_eth_1 geth attach ipc://root/.ethereum/devchain/geth.ipc
  3. sudo docker exec -it fa78bf925a6b bash geth attach /root/.ethereum/devchain/geth.ipc

All of the above scripts attach to geth and opens javascript console. But when I check "eth.hashrate" only first script produces some result, rest outputs zero.

All of these should have same behaviour, but its different, why ?

Amit Kumar
  • 31
  • 2
  • 6

1 Answers1

0

You are using the binary on your host and communicate via rpc. It works only if you have exposed your container port to the host. If you haven't exposed your container port then it means that your attaching it to geth running on your local machine (not your container). Try to stop the docker container and running the command again, if it works, it means that you have a local geth running

  • docker exec -it ethereum-docker_eth_1 geth attach ipc://root/.ethereum/devchain/geth.ipc

You are running geth attach directly in your container using ipc. IPC is a way to communicate between process using file (i may be wrong on this point)

  • sudo docker exec -it fa78bf925a6b bash geth attach /root/.ethereum/devchain/geth.ipc

You don't need to run this command under sudo if you don't have a permission denied error. Same as before your attaching geth via ipc inside the container. bash means that you run your command in through bash, you don't need this (except if you have some trouble finding geth binary).

I hope this helps you troubleshot your problem.

Noé
  • 498
  • 3
  • 14