from web3 import Web3
web3 = Web3(Web3.IPCProvider("/Ethereum/geth.ipc"))
print(f'IPC connected: {web3.isConnected()}') # want to return True我已经将上面的脚本文档化了,我试图在本地主机上连接到geth.ipc,但我似乎无法连接到它。
下面是我管理Docker的方式:
docker run --mount type=bind,source=$HOME/Library/Ethereum,target=/Ethereum container1我已经验证了geth.ipc存在于/Ethereum目录中,但似乎无法连接到它。有办法吗?
这个问题可能与这有关,这是我最初的问题https://stackoverflow.com/questions/52715141/how-to-make-a-docker-container-talk-to-geth-on-local-host
发布于 2018-12-05 14:42:19
如果您挂载包含IPC文件的文件夹,而不是直接挂载该文件,它将工作。
发布于 2018-10-11 04:11:09
使用host.docker.internal
这适用于Mac的Docker和Windows的Docker。
如果你在Linux上,事情会变得更加复杂。请看一下https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach
发布于 2018-12-05 14:50:35
https://ethereum.stackexchange.com/questions/60378
复制相似问题