Post
Topic
Board Development & Technical Discussion
Re: How to connect docker container to bitcoin node?
by
vv181
on 14/10/2022, 12:41:08 UTC
You should use the internal IP on the Python container, not localhost.

Code:
connection_url="http://%s:%s@host.docker.internal:8332/wallet/testwallet"
credentials=('testuser','testpassword')
rpc_connection = AuthServiceProxy(connection_url % credentials)
rpc_connection.getnewaddress()


If it still not works, try refer to https://www.howtogeek.com/devops/how-to-connect-to-localhost-within-a-docker-container/

internal ip like 127.0.01? but that will connect to docker localhost network not the server localhost?

I meant the internal IP of Docker.

Since you already set host.docker.internal:host-gateway, you can try to use host.docker.internal as the IP, to access the IP outside Docker container.

Try to use the modified code as I quoted above.