ruimarinho / docker-bitcoin-core

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

Added a small networking caveat. #116

Closed keblek closed 3 years ago

keblek commented 3 years ago

115

I think most people using docker compose will want the rpc functionality compose a service (lightning, coinjoin, etc) so the example should include it.

Would you welcome a minimal c-lightning example?

ruimarinho commented 3 years ago

Thanks, but I don't think this is necessary. By default, bitcoin-core already binds the IPv4 address.

E.g. on testnet:

2021-02-11T00:04:05Z Binding RPC on address 127.0.0.1 port 18332

The failure on IPv6 isn't problematic if you're not using IPv6.

keblek commented 3 years ago

Ok, maybe I can be clearer about what I am trying to do and where I am getting hung up?

I want to make a docker compose file that pulls your image and lightningd so I can set up a lightning node. I have gotten this to work manually but prefer to use docker for testing.

Right now I can't get them to do that, because lightningd can't access the RPC interface from bitcoind.

This is my docker compose file.

version: "3.3"
networks:
        lnnet:
services:
  bitcoind:
    container_name: bitcoind
    image: ruimarinho/bitcoin-core:latest
    command:
     -testnet=1
     -rpcuser=user
     -rpcpassword=pass
     -server=1
     -rpcbind=127.0.0.1
     -rpcallowip=0.0.0.0/0
    networks:
     - lnnet
    expose:
     - "18332"
  lightningd:
    container_name: lightningd
    image: elementsproject/lightningd:latest
    command:
      - --bitcoin-rpcconnect=bitcoind
      - --bitcoin-rpcuser=user
      - --bitcoin-rpcpassword=pass
      - --network=testnet
      - --plugin-dir=/usr/libexec/c-lightning/plugins
      - --alias=myawesomenode
      - --log-level=debug
    environment:
      EXPOSE_TCP: "true"
    networks:
      - lnnet
    expose:
      - "9735"
    ports:
      - "0.0.0.0:9735:9735"
    links:
      - bitcoind
    restart: always

Here you can see that lightningd can't find bitcoind.

image

I'll be closing this PR since its not a problem with your image, but if you can provide a pointer as to how to use your image with other nodes then I would greatly appreciate it.

Cheers

ruimarinho commented 3 years ago

You're binding to 127.0.0.1, so other nodes won't be able to connect to it via rpc unless you bind to the docker network range too.