一、网上查找的正常安装流程如下
1、检查配置
linux系统内核版本高于3.10,且系统是64位
uname -r
2、卸载老版本的 docker 及其相关依赖
sudo yum remove docker docker-common container-selinux docker-selinux docker-engine
3更新yum(差不多300m,阿里云轻应用服务器)
yum update
4、安装 yum源管理器yum-utils( yum-config-manager)
sudo yum install -y yum-utils
5、添加yum源(这一步是个坑)
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
当你设置了yum源的时候,你再往下走步骤时,会出现 No Mirrors to try 相关报错,这时候只能删掉原来添加的yum源,才能走下去
cd /etc/yum/repos.d # 跳转该文件夹下边
ls # 查看文件
rm -rf /etc/yum.repos.d/docker-ce.repo # 删掉刚添加的docker-ce.repo
6、更新索引
centos7:
sudo yum makecache fast
centos8:
sudo yum makecache
7、安装 docker-ce
centos8:
wget https://download.docker.com/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
yum -y install containerd.io-1.2.6-3.3.el7.x86_64.rpm
centos8 & centos7(该步骤其实安装不了):
sudo yum install -y docker-ce
在不走添加yum源的步骤以及上一条命令的的情况,可以直接执行 yum remove docker(保证未重复安装) ,再执行 yum install docker-io 即可(未提到的步骤可以走完)
8、安装docker-compose
1 安装epel源
yum install -y epel-release
2 安装docker-compose
yum install -y docker-compose
二、参考博客或文章
安装docker:https://blog.csdn.net/qq_25760623/article/details/88657491
未添加yum源安装:https://www.cnblogs.com/maodot/p/7654918.html
try other mirrors报错问题:https://xiaosi.blog.csdn.net/article/details/115419572
yum源问题相关:https://access.redhat.com/solutions/203603