1、现在有三台 阿里云linux服务器。对应的公网Ip和主机名称
47.111.111.100 master
47.111.111.101 slave1
47.111.111.102 slave2
2、 三台 分别需要安装 docker环境
参考:
【docker系列】阿里云Centos7上安装docker
3、如果需要修改主机的名称,那修改 阿里云的 主机名,命令:
[root@localhost /]# hostnamectl set-hostname 新的主机名
4、 修改 三台主机的 docker.service 文件
vim /lib/systemd/system/docker.service
# 可通过 find 命令 查找 docker.service 文件
# find / -name docker.service
## 在“ExecStart=/usr/bin/dockerd”后添加“-H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock”
# 如下
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H