diff --git a/Dockerfile b/Dockerfile index d8e6e88872c8..9607f3a7ba77 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,6 +88,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends socat inotify-t ENV LIGHTNINGD_DATA=/root/.lightning ENV LIGHTNINGD_RPC_PORT=9835 ENV LIGHTNINGD_PORT=9735 +ENV LIGHTNINGD_NETWORK=bitcoin RUN mkdir $LIGHTNINGD_DATA && \ touch $LIGHTNINGD_DATA/config diff --git a/tools/docker-entrypoint.sh b/tools/docker-entrypoint.sh index de274ae16c4c..c5bccf400ffa 100755 --- a/tools/docker-entrypoint.sh +++ b/tools/docker-entrypoint.sh @@ -2,18 +2,20 @@ : "${EXPOSE_TCP:=false}" +networkdatadir="${LIGHTNINGD_DATA}/${LIGHTNINGD_NETWORK}" + if [ "$EXPOSE_TCP" == "true" ]; then set -m lightningd "$@" & echo "C-Lightning starting" while read -r i; do if [ "$i" = "lightning-rpc" ]; then break; fi; done \ - < <(inotifywait -e create,open --format '%f' --quiet "$LIGHTNINGD_DATA" --monitor) + < <(inotifywait -e create,open --format '%f' --quiet "${networkdatadir}" --monitor) echo "C-Lightning started" echo "C-Lightning started, RPC available on port $LIGHTNINGD_RPC_PORT" - socat "TCP4-listen:$LIGHTNINGD_RPC_PORT,fork,reuseaddr" "UNIX-CONNECT:$LIGHTNINGD_DATA/lightning-rpc" & + socat "TCP4-listen:$LIGHTNINGD_RPC_PORT,fork,reuseaddr" "UNIX-CONNECT:${networkdatadir}/lightning-rpc" & fg %- else - exec lightningd "$@" + exec lightningd --network="${LIGHTNINGD_NETWORK}" "$@" fi