Closed tstrike34 closed 3 years ago
Hey tstrike34, it is probably the firewall that is blocking docker from reaching the bitcoin core rpc port.
Try this to allow docker contacting the port:
sudo ufw allow in on docker0 from 172.17.0.0/16 to any port 8332
Check before if you have the right interface and docker ip:
ifconfig
This should return something like this:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
Ok Mirobit, thank you for answer. Standby
tstrike39@tordenbitcoin:~/.bitcoin$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 fe80::42:b5ff:fec2:587 prefixlen 64 scopeid 0x20 ether 02:42:b5:c2:05:87 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 19 bytes 2766 (2.7 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tstrike39@tordenbitcoin:~/.bitcoin$ sudo ufw allow in on docker0 from 172.17.0.0/16 to any port 8332 [sudo] password for tstrike39: Sorry, try again. [sudo] password for tstrike39: Skipping adding existing rule
Any other place I should look. I followed your instructions precisely.
I am having the same issues with docker on Linux. I am not sure why it, but I am don't know docker networking too well. I just know that I got it working once.
hmmm
I am out of ideas. I can connect with netcat from to container to a port on the main machine. Also the rpc call is apparently not blocked by the firewall. But for some reason Bitcoin Core refuses the rpc connection (curl). Everything still works on Windows Docker and without Docker.
Ok. I am doing a deep dive into looking at the docker logfiles in particular the network. Probably an issue on my end. I will update this issue. I am working this right now. :)
Thanks for looking into this. I think it is a general docker Linux issue.
Viola! We have an answer.
After jumping into the docker instance, I discovered that bitcoin.conf is not configured properly. According the instructions here: https://ma.ttias.be/enable-the-rpc-json-api-with-password-authentication-in-bitcoin-core/
You will need to configure the bitcoin.conf file as such:
server=1 rpcbind=IP_ADDRESS_OF_YOUR_BITCOIN_NODE rpcallowip=0.0.0.0/0 <------This tells the process its ok to open the rpcport to folks on your network (use internal addresss not WAN) rpcport=8332 rpcuser=bitcoin rpcpassword=J9JkYnPiXWqgRzg3vAA
Please mark this closed and if you dont mind, adding this important note in your wiki?
I sincerely appreciate your help, this is amazing work and quite helpful!
Thank you very much for digging into this. I will add this info to the README.
I added it to the README (eac9e91).
This makes bitcoin core work with all services on the same machine:
rpcbind=127.0.0.1
rpcbind=172.17.0.1
rpcallowip=0.0.0.0/0
Hi and thank you for this solution!
I got things set up and I am using the docker image on Ubuntu 20.04
Bitcoin Core not reachable: Failed to connect to 127.0.0.1 port 8332: Connection refused
With my bitcoind running (bitcoin core 0.20.1) I am getting above error message.
Here is my bitcoin.conf file rpcuser=* rpcpassword=** rpcport=8332 server=1 txindex=1
Is there something missing from my bitcoin.conf file to allow for this solution to connect to bitcoin core? Is there another logfile I can look at to determine whats going on?
Thank you in advance.