一、安装Docker 设置centos yum镜像源
cd /etc/yum.repos.d/ mkdir backup && mv *repo backup/ wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo yum clean all && yum makecache yum repolist all卸载旧版本(如果安装过旧版本的话)
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine \ docker-ce安装需要的软件包yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 #设置yum源 yum-config-manager \ --add-repo \ https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo yum makecache安装docker
yum install -y docker-ce启动docker
systemctl start docker验证是否启动成功
docker version设置docker开机自启
systemctl enable docker验证开机自启是否设置成功
systemctl is-enabled docker配置镜像加速
vim /etc/docker/daemon.json #添加以下内容: { "registry-mirrors": [ "https://mirror.ccs.tencentyun.com" ] }重启docker
systemctl restart docker
二、通过rancher脚本一键快速安装docker
curl https://releases.rancher.com/install-docker/19.03.sh | sh curl https://releases.rancher.com/install-docker/20.10.sh | sh标签:com,ce,repo,引擎,yum,https,docker,安装 From: https://www.cnblogs.com/welcomer/p/18085625