diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..9cd2d42c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM golang:alpine as builder + +# Force Go to use the cgo based DNS resolver. This is required to ensure DNS +# queries required to connect to linked containers succeed. +ENV GODEBUG netdns=cgo + +# Install dependencies and build the binaries. +RUN apk add --no-cache \ + git \ + make \ +&& git clone https://github.com/lightningnetwork/lnd /go/src/github.com/lightningnetwork/lnd \ +&& cd /go/src/github.com/lightningnetwork/lnd \ +&& make \ +&& make install + +# Start a new, final image. +FROM alpine as final + +# Define a root volume for data persistence. +VOLUME /root/.lnd + +# Add bash and ca-certs, for quality of life and SSL-related reasons. +RUN apk --no-cache add \ + bash \ + ca-certificates + +# Copy the binaries from the builder image. +COPY --from=builder /go/bin/lncli /bin/ +COPY --from=builder /go/bin/lnd /bin/ + +# Specify the start command and entrypoint as the lnd daemon. +ENTRYPOINT ["lnd"] +CMD ["lnd"] diff --git a/README.md b/README.md index f492562d..a6ad6283 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ ## Lightning Network Daemon -[![Build Status](http://img.shields.io/travis/lightningnetwork/lnd.svg)](https://travis-ci.org/lightningnetwork/lnd) -[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/lightningnetwork/lnd/blob/master/LICENSE) -[![Irc](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://webchat.freenode.net/?channels=lnd) +[![Build Status](http://img.shields.io/travis/lightningnetwork/lnd.svg)](https://travis-ci.org/lightningnetwork/lnd) +[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/lightningnetwork/lnd/blob/master/LICENSE) +[![Irc](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://webchat.freenode.net/?channels=lnd) [![Godoc](https://godoc.org/github.com/lightningnetwork/lnd?status.svg)](https://godoc.org/github.com/lightningnetwork/lnd) @@ -15,13 +15,13 @@ full-node), [`bitcoind`](https://github.com/bitcoin/bitcoin), and [`neutrino`](https://github.com/lightninglabs/neutrino) (a new experimental light client). The project's codebase uses the [btcsuite](https://github.com/btcsuite/) set of Bitcoin libraries, and also exports a large set of isolated re-usable Lightning Network related libraries -within it. In the current state `lnd` is capable of: +within it. In the current state `lnd` is capable of: * Creating channels. * Closing channels. * Completely managing all channel states (including the exceptional ones!). * Maintaining a fully authenticated+validated channel graph. * Performing path finding within the network, passively forwarding incoming payments. -* Sending outgoing [onion-encrypted payments](https://github.com/lightningnetwork/lightning-onion) +* Sending outgoing [onion-encrypted payments](https://github.com/lightningnetwork/lightning-onion) through the network. * Updating advertised fee schedules. * Automatic channel management ([`autopilot`](https://github.com/lightningnetwork/lnd/tree/master/autopilot)). @@ -66,6 +66,9 @@ discuss various aspects of `lnd` and also Lightning in general. ## Installation In order to build from source, please see [the installation instructions](docs/INSTALL.md). + +## Docker + To run lnd from Docker, please see the main [Docker instructions](docs/DOCKER.md) ## IRC * irc.freenode.net diff --git a/docs/DOCKER.md b/docs/DOCKER.md new file mode 100644 index 00000000..de272ca3 --- /dev/null +++ b/docs/DOCKER.md @@ -0,0 +1,67 @@ +# Docker Instructions + +## Development/testing + +For development or testing, or to spin up a `btcd` backend alongside `lnd`, +check out the documentation at [docker/README.md](docker/README.md). + +## Production + +To use Docker in a production environment, you can run `lnd` by first creating +a Docker container, adding the appropriate command-line options as parameters. + +``` +$ docker create --name=lnd lightninglabs/lnd [command-line options] +``` + +Then, just start the container: + +``` +$ docker start lnd +``` + +## Volumes + +A Docker volume will be created with your `.lnd` directory automatically, and will +persist through container restarts. + +You can also optionally manually specify a local folder to be used as a volume: + +``` +$ docker create --name=lnd -v /media/lnd-docker/:/root/.lnd lightninglabs/lnd [command-line options] +``` + +## Example + +Here is an example testnet `lnd` that uses Neutrino: + +``` +$ docker create --name lnd-testnet lightninglabs/lnd --bitcoin.active --bitcoin.testnet --bitcoin.node=neutrino --neutrino.connect=faucet.lightning.community +``` + +Start the container: + +``` +$ docker start lnd-testnet +``` + +Create a wallet (and write down the seed): + +``` +$ docker exec -it lnd-testnet lncli create +``` + +Confirm `lnd` has begun to synchronize: + +``` +$ docker logs lnd-testnet +[snipped] +2018-05-01 02:28:01.201 [INF] RPCS: RPC server listening on 127.0.0.1:10009 +2018-05-01 02:28:01.201 [INF] LTND: Waiting for chain backend to finish sync, start_height=2546 +2018-05-01 02:28:01.201 [INF] RPCS: gRPC proxy started at 127.0.0.1:8080 +2018-05-01 02:28:08.999 [INF] LNWL: Caught up to height 10000 +2018-05-01 02:28:09.872 [INF] BTCN: Processed 10547 blocks in the last 10.23s (height 10547, 2012-05-28 05:02:32 +0000 UTC) +``` + +This is a simple example, it is possible to use any command-line options necessary +to expose RPC ports, use `btcd` or `bitcoind`, or add additional chains.