ruimarinho / docker-bitcoin-core

A bitcoin-core docker image
https://hub.docker.com/r/ruimarinho/bitcoin-core/
MIT License
365 stars 209 forks source link

Binding RPC on address ::1 port 18332 failed. #82

Closed senhanxiao closed 4 years ago

senhanxiao commented 4 years ago

Binding RPC on address ::1 port 18332 failed. 2019-09-10T02:24:04Z Bound to [::]:18333 2019-09-10T02:24:04Z Bound to 0.0.0.0:18333

senhanxiao commented 4 years ago

2019-09-10T02:24:03Z libevent: getaddrinfo: address family for nodename not supported

victorperin commented 4 years ago

I think I've stepped at this one day. I think it was related to docker and by default it doesn't set an ipv6 address.

If is it, you probably will find a way to fix here: https://docs.docker.com/v17.09/engine/userguide/networking/default_network/ipv6/

tima-t commented 4 years ago

I can not connect to the rpc from local machine. I am using rpcauth and the error is: ERROR Request Error: socket hang up

var run = function() { var RpcClient = require('bitcoind-rpc');

var config = { protocol: 'http', host: '0.0.0.0', port: '18332', username: 'jelly', password: '84k_0ftqUEcciE5hd4rd2pD0FxEreoizsf8ec5Mh_oI=' };

// config can also be an url, e.g.: // var config = 'http://user:pass@127.0.0.1:18332';

var rpc = new RpcClient(config); var txids = [];

function showNewTransactions() { rpc.getRawMemPool(function (err, ret) { if (err) { console.error(err); return setTimeout(showNewTransactions, 10000); }

  function batchCall() {
    ret.result.forEach(function (txid) {
      if (txids.indexOf(txid) === -1) {
        rpc.getRawTransaction(txid);
      }
    });
  }

  rpc.batch(batchCall, function(err, rawtxs) {
    if (err) {
      console.error(err);
      return setTimeout(showNewTransactions, 10000);
    }

    rawtxs.map(function (rawtx) {
      console.log('\n\n\n' + rawtx  + ':',);
    });

    txids = ret.result;
    setTimeout(showNewTransactions, 2500);
  });
});

}

showNewTransactions(); };

run();


ERROR Request Error: socket hang up

Os - CentOs

Net-stat tcp6 0 0 :::3000 ::: LISTEN 16610/node
tcp6 0 0 :::18332 :::
LISTEN 16437/docker-proxy- tcp6 0 0 :::18333 :::* LISTEN 16424/docker-proxy-

"Args": [ "-printtoconsole", "-rpcport=18332", "-testnet=1", "-rpcallowip=172.17.0.0/16", "-server", "-rpcauth=jelly:28e4c51254ff3f0e62591394a13bbcef$c59c63544b5bd84f7e3db60f4b16ed3d703811702d8a8a2a5cf6d99bb805fe4a" ],

"NetworkSettings": { "Bridge": "", "SandboxID": "239f4eb24daac3b2e39581ebdaa13b81eaf37964a7b49ff633d9f75b6a57b7ad", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "18332/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "18332" } ], "18333/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "18333" } ], "18443/tcp": null, "18444/tcp": null, "8332/tcp": null, "8333/tcp": null }, "SandboxKey": "/var/run/docker/netns/239f4eb24daa", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "ad6bdea30b640416db9ab7c7e5bbc174dfc5451ef5e3784e2f3e757a2318fb5a", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "02:42:ac:11:00:02", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "63b362e2b2a28332d17dd3f2126f9cc8eb8c8a2bbd6e2fbec70dbd73cdf8eca1", "EndpointID": "ad6bdea30b640416db9ab7c7e5bbc174dfc5451ef5e3784e2f3e757a2318fb5a", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:02" } } }

ruimarinho commented 4 years ago

@senhanxiao that does not create any problem unless you're trying to connect using ipv6 as mentioned by @victorperin.

@tima-t you are probably hitting the issue reported and fixed by https://github.com/ruimarinho/docker-bitcoin-core/pull/85.