Adding [source,bash] to a few more places that may need it.

pull/608/head
Hannah 3 years ago
parent 8af6f5361f
commit 71c8bfee2d

@ -174,6 +174,7 @@ docker stop cname
*Deleting a container by name*
If you name a container instead of letting docker name it randomly, you cannot reuse that name until the container is deleted. Docker will return an error like this:
[source,bash]
----
docker: Error response from daemon: Conflict. The container name "/bitcoind" is already in use...
----
@ -208,6 +209,7 @@ The container for Bitcoin Core is +bitcoind+. It is configured to run Bitcoin Co
Let us start by building and running the +bitcoind+ container. First, we use the +docker build+ command to build it:
[source,bash]
----
$ cd code/docker
$ docker build -t lnbook/bitcoind bitcoind
@ -229,6 +231,7 @@ Successfully tagged lnbook/bitcoind:latest
Next, let's run the +bitcoind+ container and have it mine some blocks. We use the +docker run+ command, with the flags for _interactive (i)_ and _terminal (t)_, and the +name+ argument to give the running container a custom name:
[source,bash]
----
$ docker run -it --name bitcoind lnbook/bitcoind
Starting bitcoind...
@ -277,6 +280,7 @@ Running the interactive shell puts us "inside" the container. It logs in as user
Instead of running an interactive shell, we can also issue a single command that is executed inside the container. In the following example we run the +bitcoin-cli+ command to obtain information about the current blockchain state:
[source,bash]
----
$ docker exec bitcoind bitcoin-cli -datadir=/bitcoind getblockchaininfo
{
@ -295,6 +299,7 @@ As you can see, we need to tell +bitcoin-cli+ where the bitcoind data directory
All our docker containers have a command-line JSON encoder/decoder named +jq+ preinstalled. +jq+ helps us to process JSON-formatted data via the command-line or from inside scripts. You can send the JSON output of any command to +jq+ using the +|+ character. This character as well as this operation is called a "pipe". Let's apply a +pipe+ and +jq+ to the previous command as follows:
[source,bash]
----
$ docker exec bitcoind bash -c "bitcoin-cli -datadir=/bitcoind getblockchaininfo | jq .blocks"
189
@ -318,6 +323,7 @@ The c-lightning software distribution has a docker container, but it is designed
We start by building the c-lightning docker container from the book's files which you previously downloaded into a directory named +lnbook+. As before, we will use the +docker build+ command in the +code/docker+ sub-directory. We will tag the container image with the tag +lnbook/c-lightning+ like this:
[source,bash]
----
$ cd code/docker
$ docker build -t lnbook/c-lightning c-lightning
@ -369,6 +375,7 @@ $ docker run -it --network lnbook --name bitcoind lnbook/bitcoind
You should see bitcoind start up and start mining blocks every 10 seconds. Leave it running and open a new terminal window to start c-lightning. We use a similar +docker run+ command with the +network+ and +name+ arguments to start c-lightning as follows:
[source,bash]
----
$ docker run -it --network lnbook --name c-lightning lnbook/c-lightning
Waiting for bitcoind to start...
@ -387,6 +394,7 @@ The c-lightning container starts up and connects to the bitcoind container over
As we demonstrated with the bitcoind container, we can issue commands to our c-lightning container in another terminal in order to extract information, open channels etc. The command that allows us to issue command-line instructions to the c-lightning node is called +lightning-cli+. To get the node info use the following +docker exec+ command in another terminal window:
[source,bash]
----
$ docker exec c-lightning lightning-cli getinfo
{
@ -434,6 +442,7 @@ https://github.com/ElementsProject/lightning/blob/master/doc/INSTALL.md
The common first step is the installation of prerequisite libraries. We use the +apt+ package manager to install these:
[source,bash]
----
$ sudo apt-get update
@ -474,6 +483,7 @@ After a few minutes and a lot of on-screen activity, you will have installed all
Next, we will copy the latest version of c-lightning from the source code repository. To do this, we will use the +git clone+ command which clones a version-controlled copy onto your local machine thereby allowing you to keep it synchronized with subsequent changes without having to download the whole repository again:
[source,bash]
----
$ git clone https://github.com/ElementsProject/lightning.git
Cloning into 'lightning'...
@ -499,6 +509,7 @@ Next, we use a set of _build scripts_ that are commonly available in many open s
Running the +configure+ with the +help+ option will show us all the available options:
[source,bash]
----
$ ./configure --help
Usage: ./configure [--reconfigure] [setting=value] [options]
@ -543,6 +554,7 @@ $
Next, we use the +make+ command to build the libraries, components, and executables of the c-lightning project. This part will take several minutes to complete and will use your computer's CPU and disk heavily. Expect some noise from the fans! Run +make+:
[source,bash]
----
$ make
@ -629,6 +641,7 @@ $ docker run -it --network lnbook --name bitcoind lnbook/bitcoind
Next, we start the LND container we just built. As done before we need to attach it to the +lnbook+ network and give it a name:
[source,bash]
----
$ docker run -it --network lnbook --name lnd lnbook/lnd
Waiting for bitcoind to start...
@ -648,6 +661,7 @@ The LND container starts up and connects to the bitcoind container over the dock
As we demonstrated previously, we can issue commands to our container in another terminal in order to extract information, open channels etc. The command that allows us to issue command-line instructions to the +lnd+ daemon is called +lncli+. Let's get the node info using the +docker exec+ command in another terminal window:
[source,bash]
----
$ docker exec lnd lncli -n regtest getinfo
{
@ -726,6 +740,7 @@ $ make && make install
After several minutes you will have two new commands +lnd+ and +lncli+ installed. Try them out and check their version to ensure they are installed:
[source,bash]
----
$ lnd --version
lnd version 0.10.99-beta commit=clock/v1.0.0-106-gc1ef5bb908606343d2636c8cd345169e064bdc91
@ -748,6 +763,7 @@ In the next few sections we will build a docker container to run Eclair, as we d
By now, you are almost an expert in the basic operations of docker! In this section we will repeat many of the previously seen commands to build the Eclair container. The container is located in +code/docker/eclair+. We start in a terminal, by switching the working directory to +code/docker+ and issuing the +docker build+ command:
[source,bash]
----
$ cd code/docker
$ docker build -t lnbook/eclair eclair
@ -804,6 +820,7 @@ The Eclair container starts up and connects to the bitcoind container over the d
As we demonstrated previously, we can issue commands to our container in another terminal in order to extract information, open channels etc. The command that allows us to issue command-line instructions to the +eclair+ daemon is called +eclair-cli+. The +eclair-cli+ command expects a password which we have set to "eclair" in this container. We pass the password +eclair+ to the +eclair-cli+ command via the +p+ flag. Using the +docker exec+ command in another terminal window we get the node info from Eclair:
[source,bash]
----
$ docker exec eclair eclair-cli -p eclair getinfo
{
@ -845,6 +862,7 @@ $ sudo apt install -y openjdk-11-jdk maven
Verify that you have the correct version installed by running:
[source,bash]
----
$ javac -version
javac 11.0.7

Loading…
Cancel
Save