#!/bin/bash
#docker_ce_version='-20.10.10-3.el7'
yum install -y yum-utils
#rm -rf /etc/yum.repos.d/*
bakdir=`date +%F`
mkdir -p /etc/yum.repos.d/$bakdir
mv /etc/yum.repos.d/* /etc/yum.repos.d/$bakdir/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel.repo
sed -i.bak -e 's/mirrors.aliyuncs.com/mirrors.tuna.tsinghua.edu.cn/' \
-e 's/mirrors.cloud.aliyuncs.com/mirrors.cloud.tencent.com/' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/6/7/' /etc/yum.repos.d/epel.repo
yum clean all
yum -y install docker docker-client
systemctl enable --now docker
#speed up
mkdir -p /etc/docker
cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors":["https://reg-mirror.qiniu.com/"]
}
EOF
systemctl daemon-reload ; systemctl restart docker
systemctl enable --now docker
docker version