ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.85k stars 902 forks source link

How do you start the development environment with Docker? #5845

Open koodinmies opened 1 year ago

koodinmies commented 1 year ago

I'm running:

docker run elementsproject/lightningd:latest

Console prints:


Could not connect to bitcoind using bitcoin-cli. Is bitcoind running?

Make sure you have bitcoind running and that bitcoin-cli is able to connect to bitcoind.

You can verify that your Bitcoin Core installation is ready for use by running:

In the documentation it tells me this: https://hub.docker.com/r/elementsproject/lightningd/

If you want to experiment with lightningd, there's a script to set up a bitcoind regtest test network of two local lightning nodes, which provides a convenient start_ln helper. See the notes at the top of the startup_regtest.sh file for details on how to use it.

. contrib/startup_regtest.sh

I just don't understand how am I supposed to start it differently? Sorry if this is stupid question.

ekzyis commented 1 year ago

Do you have bitcoind installed and synced? https://bitcoincore.org/en/download/

From your link:

c-lightning only works on Linux and Mac OS, and requires a locally (or remotely) running bitcoind (version 0.16 or above) that is fully caught up with the network you're running on, and relays transactions (ie with blocksonly=0). Pruning (prune=n option in bitcoin.conf) is partially supported, see here for more details.

cdecker commented 1 year ago

There are a number of ways to solve this, but first we need to explain what the issue here is: we need to be able to talk to bitcoind so we can communicate with the bitcoin network.

Usually we'd expect bitcoind to be either co-located with CLN or have bitcoin-cli configured to connect somewhere else. If you can run bitcoin-cli getnetworkinfo and it returns a result you're good to go. The problem with docker containers is that they get their own FS and their own network, so any configuration done on the host likely will not be passed in to the docker container. We can do a couple of things here:

Lots of options you can try and find the perfect solution for you. And if you want to sidestep all things bitcoind you could also run trustedcoin which replaces bitcoind with something that queries with block explorers.

cdecker commented 1 year ago

In the documentation it tells me this: https://hub.docker.com/r/elementsproject/lightningd/

If you want to experiment with lightningd, there's a script to set up a bitcoind regtest test network of two local lightning nodes, which provides a convenient start_ln helper. See the notes at the top of the startup_regtest.sh file for details on how to use it.

. contrib/startup_regtest.sh

I just don't understand how am I supposed to start it differently? Sorry if this is stupid question.

This relates solely to lightningd running on the same machine as you're executing the script, not in docker. It is intended as a quick and easy way to spin up a regtest network to test against, not running a production node as the docker setup likely is.

vincenzopalazzo commented 1 year ago

Does this look like fixed (answered)? we can close it?