简体   繁体   English

如何使Docker容器与本地主机上的geth对话

[英]How to make a Docker container talk to geth on local host

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. 我有一个使用web3 Dockerized的简单python脚本,正在尝试连接到本地主机上的geth.ipc,但似乎无法连接到它。 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 而且我正在安装我的$HOME/Library/Ethereum/geth.ipc > /Ethereum/geth.ipc

如果您挂载包含IPC文件的文件夹而不是直接挂载该文件,它将起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将Docker容器环回绑定到主机环回 - Bind docker container loopback to the host loopback 在Docker容器和主机之间同步文件 - sync files between docker container and host machine 如何将 python 文件发送到 docker 容器(使用 python 映像)并获取 Z78E6221F6393D1356681 到本地的 DB398DZF - how to send python file to docker container(using python image) and get the output back to local 如何通过本地 Docker 容器中的 python 应用程序从云存储桶中读取文件 - How to read a file from a cloud storage bucket via a python app in a local Docker container 以编程方式从 Docker 容器中获取主机的 ip 和 Python - Programmatically get host's ip from within Docker container with Python 如何在 Spyder 中运行 Docker 容器 - How to run Docker Container in Spyder Celery无法从Docker容器中连接到本地PostgreSQL - Celery can't connect to local PostgreSQL from within Docker container 使用boto3从docker容器内部连接到DynamoDB Local - Connect to DynamoDB Local from inside docker container with boto3 Python 在带有本地 SMTP 服务器的 docker 容器内发送邮件 - Python send mail inside docker container with local SMTP server Discord.py | 如何根据输入的内容进行机器人对话? - Discord.py | How to make a bot talk from what you put in input?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM