centos安装指定版本的docker并添加多源加速器

1. 安装指定版本的docker

yum -y install epel-release wget
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
yum list docker-ce --showduplicates | sort -r #查看yum仓库中可以安装的docker版本
yum -y install docker-ce-20.10.9-3.el7 #安装固定版本
yum -y install docker-ce  #安装docker最新版
systemctl enable docker && systemctl start docker 

cat > /etc/docker/daemon.json << EOF
{
 "registry-mirrors":["https://rsbud4vc.mirror.aliyuncs.com","https://registry.docker-cn.com","https://docker.mirrors.ustc.edu.cn","https://dockerhub.azk8s.cn","http://hub-mirror.c.163.com","http://qtid6917.mirror.aliyuncs.com", "https://rncxm540.mirror.aliyuncs.com"],
  "exec-opts": ["native.cgroupdriver=systemd"]
} 
EOF

systemctl daemon-reload && systemctl restart docker &&  systemctl status docker
docker --version

2. 安装最新版本的docker

yum -y install epel-release wget
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
#yum list docker-ce --showduplicates | sort -r #查看yum仓库中可以安装的docker版本
yum -y install docker-ce  #安装docker最新版
systemctl enable docker && systemctl start docker 

cat > /etc/docker/daemon.json << EOF
{
 "registry-mirrors":["https://rsbud4vc.mirror.aliyuncs.com","https://registry.docker-cn.com","https://docker.mirrors.ustc.edu.cn","https://dockerhub.azk8s.cn","http://hub-mirror.c.163.com","http://qtid6917.mirror.aliyuncs.com", "https://rncxm540.mirror.aliyuncs.com"],
  "exec-opts": ["native.cgroupdriver=systemd"]
} 
EOF

systemctl daemon-reload && systemctl restart docker &&  systemctl status docker
docker --version

你可能感兴趣的:(linux,docker容器相关,centos,docker,linux)