lnd.xprv/docs/DOCKER.md
tyzbit fbc722147f lnd+docker: add "Production" Docker Image
This commit satisfies the auto-build functionality desired in #722 without changing anything in the docker folder. This allows development and testing to continue to build and use images locally, but external users get a very lean Docker image they can use. The size difference is appreciable.

REPOSITORY                     TAG                 IMAGE ID            CREATED             SIZE
lnd                            latest              3634dcf5df68        17 seconds ago      1.19GB
lnd-single                     latest              b295cc248447        30 minutes ago      56MB
Right before merging this PR, an Automated Build repository should be configured on the appropriate account (lightningnetwork?) on Docker Hub with the name of lnd in order to match documentation.

I see there are already some repositories created, however I think best practice for Docker is to have a single repository and different tags for different architectures. The included image is based off of Alpine, but in the future we could extend into multiple Dockerfiles (example: ARM support, or being Ubuntu based).

So in this proposed scenario, lightningnetwork/lnd:latest would be alpine, but lightningnetwork/lnd:ubuntu would be an ubuntu-based image, for example.

(With thanks to @alingenhag for https://github.com/f-u-z-z-l-e/docker-lnd/ from which I borrowed heavily)
2018-05-16 18:50:25 -07:00

1.8 KiB

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.

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.