lncm / docker-bitcoind

Flexible multi-arch (amd & amd64) Bitcoin Core Docker image
https://hub.docker.com/r/lncm/bitcoind
MIT License
101 stars 34 forks source link

Listen Port Missing? #87

Closed RapidFire05 closed 1 year ago

RapidFire05 commented 1 year ago

Can someone help clarify something for me? The docs say launch with this command:

docker run  -it  --rm  --detach \
    -v ~/.bitcoin:/data/.bitcoin \
    -p 8332:8332 \
    -p 8333:8333 \
    -p 28332:28332 \
    -p 28333:28333 \
    --name bitcoind \
    lncm/bitcoind:v25.0

With the ports meaning this:

port 8332 will be reachable for the RPC communication,
port 8333 will be reachable for the peer-to-peer communication,
port 28332 will be reachable for ZMQ block notifications,
port 28333 will be reachable for ZMQ transaction notifications,

However, when I netstat -l inside the container i do not see anything listening on 8333. This is what I see:

Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:28333           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:28332           0.0.0.0:*               LISTEN
tcp        0      0 localhost:8334          0.0.0.0:*               LISTEN
tcp        0      0 localhost:8332          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.11:40007        0.0.0.0:*               LISTEN
udp        0      0 127.0.0.11:50331        0.0.0.0:*

Should I be seeing something listening on 8333?

RapidFire05 commented 1 year ago

So it was because I was setting bind=. When I removed the bind entirely, netstat showed a listen on 8333 and the node was reachable via onion service. bind=localhost:8333 doesnt work. bind=127.0.0.1:8333 doesnt work. My node only seems reachable when I dont have anything in bind but the instructions seem to say dont do that. My tor proxy is in a separate container. The outbound connections through tor work fine. But the node is only reachable when I dont bind anything. Any thoughts? Thanks.

Tor conf where 172.19.0.11 is the bitcoin core container. HiddenServicePort 8333 172.19.0.11:8333

nolim1t commented 1 year ago

it must be using host networking also or it will be bound to an internal docker network.

RapidFire05 commented 1 year ago

I went ahead and built a custom docker image with both tor and btc in the same container. Then following the guides on the bitcoin tor docs, now just getting http403 when checking node status on bitnodes.

Edit: 403 was because bitnodes website was timed out but not informing me. A refresh of the page caused the node to be reachable. So conclusion is that following the guide for bitcoin and tor works fine but only when tor and btc are together. When I was separating them into dif containers, some weirdness appeared.

nolim1t commented 1 year ago

Interesting I feel it is much better to have things separated so its easier to troubleshoot issues.

You can use docker-compose to actually make things work together which is a lot better solution.

You can take a look at this repo for how that actually works https://github.com/lncm/thebox-compose-system