至少要熟悉fabric。之前部署过简单的案例及cello项目,后来更换工作后,又放下了,国内环境来说,联盟链的市场毕竟还是风口。在此记录下,所有的学习过程。
开发环境准备:
系统环境:阿里云服务器 2h-8g-2m centos7.8
1. 安装docker && docker compose
1.1
先移除之前的安装:
sudo yum remove docker \
> docker-client \
> docker-client-latest \
> docker-common \
> docker-latest \
> docker-latest-logrotate \
> docker-logrotate \
> docker-engine \
> docker-selinux \
> docker-engine-selinux \
> container-selinux \
> docker-ce \
> docker-ce-cli
官网给到shell脚本快速安装docker:
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun
查看安装版本:
docker -v
启动/重启/关闭命令:
systemctl start/restart/stop docker
验证:
docker run hello-world
输出:
[root@iZ8vbac6tgfha4b fabric_install]# docker run hello-world
Unable to find image 'hello-world:latest' locally // 会先去下载hello-world镜像
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:49a1c8800c94df04e9658809b006fd8a686cab8028d33cfba2cc049724254202
Status: Downloaded newer image for hello-world:latest
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.
(amd64)
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://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
1.2 安装docker compose
1.2.1 受网速影响较严重
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
1.2.2 通过pip安装
安装python-pip
yum -y install epel-release
yum -y install python-pip
pip install --upgrade pip
pip install docker-compose
python2 不再受团队支持,centos本身许多环境也需要python2默认支持,为防止诸多麻烦,建议稍等会时间用第一种方法。
以上方法都不行的时候,
wget https://github.com/docker/compose/releases/download/1.27.0-rc1/docker-compose-Linux-x86_64
mv docker-compose-Linux-x86_64 /usr/bin/docker-compose
chmod +x docker-compose
查看版本:docker-compose version