[Ethereum] IPC Connect to Ethereum node running on docker

ipc

I am creating a Ruby client to connect to Ethereum node inside a docker container. So far,

I was able to run ethereum-go inside docker container Then I bash into docker container & able to connect my ruby client using ipc file location .ethereum/rinkeby/geth.ipc

But is there a way I can connect to that docker ethereum node from another container? or else from host computer? Because I want to run my Ruby client in another container

Best Answer

I am not familiar with RUBY. I am trying same in GoLang though.

I hope my work can help you get started. I created this docker-compose.yml. I run the client by docker-compose up.

version: '2'

services:
  etherum-client:
      image: ethereum/client-go:stable
      ports:
          - "30303:30303"
          - "8545:8545"
      volumes:
          - ./share/ethereum/:/root/.ethereum/
      command: --rinkeby --rpc --rpcaddr "0.0.0.0" --fast

As the volume is shared, you get the geth.ipc file created in your MAC also.

ALSO you can SH into the docker client by simple command docker exec -it <container name> sh

Inside shell I can then connect to geth using command geth attach ipc:/root/.ethereum/rinkeby/geth.ipc

Hope it helps.

Related Topic