Docker examples or documentation
Are there any examples of how to run this as a docker container?
I am using the following docker-compose.yml file but keep getting an error about a connection to /root/.lightning being refused.
version: "3.8"
services:
rest:
image: saubyk/c-lightning-rest:0.7.2
ports:
- "3001:3001"
- "4001:4001"
volumes:
- ./data/lightning:/root/.lightning
lightning:
image: elementsproject/lightningd:latest
command:
- --bitcoin-rpcconnect=bitcoind
- --network=regtest
- --alias=myawesomenode
- --log-level=debug
- --grpc-port=8001
volumes:
- ./data/lightning:/root/.lightning
- ./data/bitcoin:/root/.bitcoin
ports:
- "8001:8001"
bitcoind:
image: lncm/bitcoind:v22.0@sha256:37a1adb29b3abc9f972f0d981f45e41e5fca2e22816a023faa9fdc0084aa4507
volumes:
- ${PWD}/data/bitcoin:/data/.bitcoin
restart: on-failure
ports:
- "18443:18443"
Errors:
rest_1 | Reading config file
rest_1 | warn: --- Starting the cl-rest server ---
rest_1 | Generating a RSA private key
rest_1 | ............................+++++
rest_1 | ...............................................................................+++++
rest_1 | writing new private key to './certs/key.tmp.pem'
rest_1 | -----
rest_1 | writing RSA key
rest_1 | warn: --- cl-rest api server is ready and listening on port: 3001 ---
rest_1 | warn: --- cl-rest doc server is ready and listening on port: 4001 ---
rest_1 | error: Lightning client connection error
rest_1 | events.js:291
rest_1 | throw er; // Unhandled 'error' event
rest_1 | ^
rest_1 |
rest_1 | Error: connect ECONNREFUSED /root/.lightning
rest_1 | at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
rest_1 | Emitted 'error' event on LightningClient instance at:
rest_1 | at Socket.<anonymous> (/usr/src/app/lightning-client-js.js:77:23)
rest_1 | at Socket.emit (events.js:314:20)
rest_1 | at emitErrorNT (internal/streams/destroy.js:92:8)
rest_1 | at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
rest_1 | at processTicksAndRejections (internal/process/task_queues.js:84:21) {
rest_1 | errno: 'ECONNREFUSED',
rest_1 | code: 'ECONNREFUSED',
rest_1 | syscall: 'connect',
rest_1 | address: '/root/.lightning'
rest_1 | }
clightning_rest_1 exited with code 1
Any ideas of what settings to use here to get c-lightning-REST talking with c-lightning?
Hi @KayBeSee is your core lightning also running on docker?
C-Lightning-REST needs to access the lightning-rpc to be able to talk to core lightning. From the log above it's trying to find it at /root/.lightning and not able to access it.
Here's a recommended yml, which you can try. I added a link to the lightning service in the rest fragment
services:
rest:
image: saubyk/c-lightning-rest:0.7.2
ports:
- "3001:3001"
- "4001:4001"
links:
- lightning
volumes:
- ./data/lightning:/root/.lightning
lightning:
image: elementsproject/lightningd:latest
command:
- --bitcoin-rpcconnect=bitcoind
- --network=regtest
- --alias=myawesomenode
- --log-level=debug
- --grpc-port=8001
volumes:
- ./data/lightning:/root/.lightning
- ./data/bitcoin:/root/.bitcoin
ports:
- "8001:8001"
bitcoind:
image: lncm/bitcoind:v22.0@sha256:37a1adb29b3abc9f972f0d981f45e41e5fca2e22816a023faa9fdc0084aa4507
volumes:
- ${PWD}/data/bitcoin:/data/.bitcoin
restart: on-failure
ports:
- "18443:18443"
You can also refer to BTCPayserver yml file, where Cl-rest is configured: https://github.com/btcpayserver/btcpayserver-docker/blob/a0548fb688fcdaed7d8c80e08b94a87b773ebce5/docker-compose-generator/docker-fragments/bitcoin-clightning.yml
Thanks
Ya I am having no luck with this either...
docker-compose.yaml:
version: "3"
services:
bitcoind:
image: lncm/bitcoind:v0.21.1
restart: on-failure
container_name: bitcoind
volumes:
- ./bitcoind:/data/.bitcoin
ports:
- 18443:18443
- 8333:8333
- 28332:28332
- 28333:28333
alice-cln:
image: elementsproject/lightningd
restart: on-failure
container_name: alice-cln
links:
- bitcoind
volumes:
- ./lightning/regtest:/root/.lightning/regtest
- ./bitcoind:/root/.bitcoin
ports:
- 10019:10019
command: |
--network=regtest
bitcoin.conf:
regtest=1
fallbackfee=0.0002
rpcuser=theuser
rpcpassword=thepass
zmqpubhashblock=tcp://0.0.0.0:28332
zmqpubhashtx=tcp://0.0.0.0:28333
[regtest]
txindex=1
server=1
rpcport=18443
rpcbind=bitcoind
rpcbind=127.0.0.1
rpcallowip=0.0.0.0/0
lightning config:
bitcoin-rpcuser=theuser
bitcoin-rpcpassword=thepass
bitcoin-rpcconnect=bitcoind
bitcoin-rpcport=18443
grpc-port=10019
Anyone see anything wrong with this setup?