4장에서는 라이트닝 네트워크 노드를 실행하는 소프트웨어를 알아보고 도커를 이용해 직접 설치 & 실행해본다.
sudo apt-get install ca-certificates curl gnupg lsb-release
# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Set up the stable repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
#Install Docker Engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
# 사용자에게 docker 실행 권한 부여
sudo usermod -a -G docker #USERID
# 사용자 계정으로 다시 로그인 후 아래 명령어로 그룹 확인
id
# Docker Hub에서 최신 컨테이너 가져오기
docker pull lnbook/bitcoind
# Docker Hub에서 pull한 경우 빌드 할 필요 없음
cd lnbook/code/docker
docker run -it --name bitcoind lnbook/bitcoind
# bitcoind 컨테이너가 실행되는 동안 쉘로 들어가 명령 전달 가능
docker exec -it bitcoind /bin/bash
# 쉘을 실행하면 컨테이너 내부에 있게되며, root로 로그인 됨.
# 아래와 같이 단일 쉘 명령을 전달할 수도 있음
docker exec bitcoind cli getblockchaininfo
docker pull lnbook/c-lightning
docker build -t lnbook/c-lightning c-lightning
# 도커 컨테이너들은 도커 시스템에서 관리하는 가상 LAN을 통해 "taik" 할수 있다.
# 각 컨테이너는 이름을 가질수 있고, 다른 컨테이너에서 이 이름을 통해 IP를 확인하고 연결한다.
# 네트워트 설정은 저장되며, 재부팅 후 도커가 시작될 때마다 설정한 네트워크를 활성화 시킴.
# host, bridge, none 이라는 3개의 네트워크가 있음.
docker network create lnbook
docker network ls
NETWORK ID NAME DRIVER SCOPE
f315b2ae7873 bridge bridge local
1e256c4897da host host local
5602e4f8b1a0 lnbook bridge local
2df47d6e602d none null local
# 이전 컨테이너 삭제 & 비트코인 코어 실행
docker rm bitcoind
docker run -it --network lnbook --name bitcoind lnbook/bitcoind
# c-lightning 실행
docker run -it --network lnbook --name c-lightning lnbook/c-lightning
docker pull lnbook/lnd
docker run -it --network lnbook --name bitcoind lnbook/bitcoind
docker run -it --network lnbook --name lnd lnbook/lnd
docker run -it --network lnbook --name lnd2 lnbook/lnd
docker pull lnbook/eclair
docker run -it --network lnbook --name bitcoind lnbook/bitcoind
docker run -it --network lnbook --name eclair lnbook/eclair
docker run -it --network lnbook --name eclair2 lnbook/eclair
[Mastering the Lightning Network] 6 - 라이트닝 네트워크 아키텍쳐 (0) | 2021.12.28 |
---|---|
[Mastering the Lightning Network] 5 - 라이트닝 네트워크 노드 운영하기 (1) | 2021.12.24 |
[Mastering the Lightning Network] 3 - 라이트닝 네트워크는 어떻게 동작하나 (0) | 2021.12.17 |
[Mastering the Lightning Network] 2 - 시작하기 (0) | 2021.12.16 |
[Mastering the Lightning Network] 1 - Introduction (0) | 2021.12.10 |