删除旧版本
yum remove docker docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
添加repo
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
安装
yum install -y docker-ce docker-ce-cli containerd.io
systemctl enable docker & systemctl start docker
docker 镜像加速,申请阿里账号,获取专属加速通道
mkdir -p /etc/docker
cat <<EOF >/etc/docker/daemon.json
{
"registry-mirrors": ["https://xxxxxx.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
systemctl daemon-reload & systemctl restart docker