一、运行环境
Ubuntu16.04、go1.9.2、docker17.12.0-ce
二、安装go
最新的docker17.12.0-ce 需要go1.9.2支持,参考之前文章进行安装地址:
http://blog.csdn.net/zxs9999/article/details/78874807
三、安装docker
docker官方安装教程地址:
https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#upgrade-docker-ce
1、卸载历史版本docker
$ sudo apt-get remove docker docker-engine docker.io
2、安装docker
$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
2.1安装最新稳定版本docker
$ sudo apt-get update
$ sudo apt-get install docker-ce
2.2安装指定版本docker
$ apt-cache madison docker-ce
docker-ce | 17.12.0~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 17.09.1~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 17.09.0~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 17.06.2~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 17.06.1~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 17.06.0~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 17.03.2~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 17.03.1~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
选择需要的版本,例如: 17.12.0~ce-0~ubuntu 执行以下语句
$ sudo apt-get install docker-ce=‘17.12.0~ce-0~ubuntu’
3、校验安装是否成功(下载docker镜像文件hello-world)
$ sudo docker run hello-world
显示以下信息为成功
Hello from Docker!
This message shows that your installation appears to be working correctly.
四、以太坊客户端安装
$ sudo docker version
1、启动镜像
$ sudo service docker start
2、本地安装镜像文件
查看
$ sudo docker images
3、安装以太坊客户端镜像文件
$ sudo docker pull ethereum/client-go
$ sudo docker images
显示结果:
REPOSITORY TAG IMAGE ID CREATED SIZE
ethereum/client-go latest f13c73d098d8 16 hours ago 43MB
hello-world latest f2a91732366c 5 weeks ago 1.85kB
4.1、控制台交互式启动
以下命令启动节点可以使用javascript控制台进行交互操作。
$ sudo docker run -it -p 30303:30303 ethereum/client-go console
4.2、普通启动
$ sudo docker run -it -p 30303:30303 ethereum/client-go
4.3 可远程交互式启动
$ sudo docker run -it -p 8545:8545 -p 30303:30303 ethereum/client-go --rpc --rpcaddr "0.0.0.0"
“0.0.0.0”参数会在8545接口上接收所有主机发送的请求,公共网络慎用!
4.4、指定存储位置启动
$ sudo docker run -it -p 30303:30303 -v /path/on/host:/root/.ethereum ethereum/client-go