2

I have a simple python script using web3 Dockerized and I'm trying to connect to geth.ipc on local host and I can't seem to connect to it. Is there a way to do it?

Python:

from web3 import Web3

web3 = Web3(Web3.IPCProvider("/Ethereum/geth.ipc"))
print(f'IPC connected: {web3.isConnected()}')  # want to return True

And I'm mounting my $HOME/Library/Ethereum/geth.ipc -> /Ethereum/geth.ipc

TylerH
  • 20,799
  • 66
  • 75
  • 101
Eric
  • 25
  • 4
  • Show how you mounted – prisar Oct 09 '18 at 07:17
  • How are you running the docker instance? The docs suggest you need something like an `--ipc=host` https://docs.docker.com/engine/reference/run/#ipc-settings---ipc – carver Oct 09 '18 at 14:19
  • `docker run --mount type=bind,source=$HOME/Library/Ethereum,target=/Ethereum container1` I verified that `geth.ipc` file is mounted to the container but can't seem to connect to it – Eric Oct 09 '18 at 19:20
  • Adding `--ipc=host` doesn't seem to solve the issue. – Eric Oct 09 '18 at 22:01
  • 1
    If anyone’s interested, I submitted an issue at geth repo: https://github.com/ethereum/go-ethereum/issues/17907 – Eric Oct 20 '18 at 00:36

1 Answers1

0

If you mount the folder containing the IPC file rather than mounting the file directly it will work.

Daniel
  • 935
  • 2
  • 6
  • 11