1、安装docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
#失败重新安装,先删除rm -f /etc/yum.repos.d/local.rep,docker-ce.repo,在重新安装
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum update -y && yum install -y docker-ce
2、docker配置,bip网段与宿主机配置一致
mkdir -p /data/docker
mkdir /etc/docker
vi /etc/docker/daemon.json
{
"data-root": "/data/docker",
"storage-driver": "overlay2",
"insecure-registries": ["registry.access.redhat.com","quay.io","harbor.yn.com"],
"registry-mirrors": ["https://qc20rc43.mirror.aliyuncs.com"],
"bip": "172.7.100.1/24",
"exec-opts": ["native.cgroupdriver=systemd"],
"live-restore": true,
"log-driver": "json-file",
"log-opts": { "max-size": "100m" }
}
3、启动docker
systemctl daemon-reload
systemctl start docker
systemctl enable docker