1 安装docker
[root@i-k11xnd1o etc]# yum install docker
查看docker版本,报错
[root@i-k11xnd1o etc]# docker version
Client:
Version: 1.12.6
API version: 1.24
Package version: docker-1.12.6-32.git88a4867.el7.centos.x86_64
Go version: go1.7.4
Git commit: 88a4867/1.12.6
Built: Mon Jul 3 16:02:02 2017
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
解决办法
[root@i-k11xnd1o etc]# sudo su -
[root@i-k11xnd1o etc]# service docker stop
Redirecting to /bin/systemctl stop docker.service
[root@i-k11xnd1o etc]# service docker start
Redirecting to /bin/systemctl start docker.service
[root@i-k11xnd1o etc]# docker version
Client:
Version: 1.12.6
API version: 1.24
Package version: docker-1.12.6-32.git88a4867.el7.centos.x86_64
Go version: go1.7.4
Git commit: 88a4867/1.12.6
Built: Mon Jul 3 16:02:02 2017
OS/Arch: linux/amd64
Server:
Version: 1.12.6
API version: 1.24
Package version: docker-1.12.6-32.git88a4867.el7.centos.x86_64
Go version: go1.7.4
Git commit: 88a4867/1.12.6
Built: Mon Jul 3 16:02:02 2017
OS/Arch: linux/amd64
测试一下docker,run一个hello-world容器
[root@i-k11xnd1o etc]# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
b04784fba78d: Pull complete
Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
查看镜像
[root@i-k11xnd1o etc]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/hello-world latest 1815c82652c0 4 weeks ago 1.84 kB
查看所有的容器
[root@i-k11xnd1o etc]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2efa9f365613 hello-world "/hello" 44 seconds ago Exited (0) 44 seconds ago furious_keller
安装docker-compose
在安装完 docker 后, 我们常常安装 docker-compose 来简化 docker 的日常维护,
但是由于 GitHub 在国内较慢, 经常安装不了,所以使用 DaoCloud 提供的镜像来快速安装
- 官方的安装方法
$ curl -L "https://github.com/docker/compose/releases/download/1.10.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
- 使用DaoCloud镜像安装 docker-compose
安装 docker yum install docker
安装 docker-compose
$ curl -L https://get.daocloud.io/docker/compose/releases/download/1.11.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
Docker 镜像加速
由于下载镜像较慢, 可以使用 DaoCloud 提供的镜像对 Docker 进行加速
$ curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://0835afe2.m.daocloud.io
查看版本,在这里直接查看是看不到的,所以先执行上面一条语句复制它到usr/bin再查看就ok了
[root@i-k11xnd1o /]# cp /usr/local/bin/docker-compose /usr/bin/
[root@i-k11xnd1o /]# docker-compose -version
docker-compose version 1.11.1, build 7c5d5e4
2 读者可自行从github下载ethereum-docker 资源
[root@i-t5u53x8o ~]#yum -y install wget
[root@i-t5u53x8o ~]#wget -O ethereum-docker-master.zip https://codeload.github.com/blockchain101/ethereum-docker/zip/master
[root@i-t5u53x8o ~]#yum install zip unzip
[root@i-t5u53x8o ~]# unzip ethereum-docker-master.zip
[root@i-t5u53x8o ~]# ll
total 12
drwxr-xr-x 3 root root 4096 Jun 13 18:15 ethereum-docker-master
-rw-r--r-- 1 root root 4487 Jul 20 11:05 ethereum-docker-master.zip
3 通过docker-compose直接启动测试网络
cd ethereum-docker-master/ethereum-docker/ethereum-testnet-docker/
docker-compose -f docker-compose-ethereum-testnet.yaml up
然后进入漫长的下载和区块的初始化过程
BUG[07-20|06:44:42] Ethereum peer connected id=6f9357f09f77d769 conn=dyndial name=Geth/v1.6.6-stable-10a45cb5/linux-amd64/go1.8.1
geth-cluster0 | DEBUG[07-20|06:44:43] Ethereum handshake failed id=6f9357f09f77d769 conn=dyndial err=EOF
geth-cluster0 | DEBUG[07-20|06:44:43] Removing p2p peer id=6f9357f09f77d769 conn=dyndial duration=282.893ms peers=4 req=true err="subprotocol error"
geth-cluster0 | DEBUG[07-20|06:44:43] Recalculated downloader QoS values rtt=20s confidence=1.000 ttl=1m0s
geth-cluster0 | DEBUG[07-20|06: