6. 部署docker容器环境(10.4.7.200、10.4.7.21、10.4.7.22主机)

6.1 下载安装docker

  1. [root@hdss7-21 ~]# wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  2. [root@hdss7-21 ~]# yum install -y docker-ce

6.2 配置docker文件

[root@hdss7-200 ~]# mkdir -p /etc/docker/ /data/docker
# 不安全的registry中增加了harbor地址
# 各个机器上bip网段不一致,bip中间两段与宿主机最后两段相同,目的是方便定位问题
[root@hdss7-200 ~]# vim /etc/docker/daemon.json
{
  "graph": "/data/docker",
  "storage-driver": "overlay2",
  "insecure-registries": ["registry.access.redhat.com","quay.io","harbor.od.com"],
  "registry-mirrors": ["https://registry.docker-cn.com"],
  "bip": "172.7.200.1/24",
  "exec-opts": ["native.cgroupdriver=systemd"],
  "live-restore": true
}

# 启动docker
[root@hdss7-200 ~]# systemctl start docker ; systemctl enable docker