yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装Docker Engine - Community --此命令会安装最新版本(latest)
yum install docker-ce docker-ce-cli containerd.io
报如下错误:
问题: package docker-ce-3:20.10.1-3.el7.x86_64 requires containerd.io >= 1.4.1, but none of the providers can be installed
查询可安装的Docker版本
列出并排序您存储库中可用的版本,按版本号(从高到低)对结果进行排序。
yum list docker-ce --showduplicates | sort -r
此时列出了当前可安装的所有稳定版版本,在这里就以docker-ce-19.03.9-3.el7版为例。
yum install -y docker-ce-19.03.9-3.el7 docker-ce-cli-19.03.9-3.el7 containerd.io
依旧报错
问题: package docker-ce-3:19.03.9-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
手动安装container.io
打开下面这个网站
https://mirrors.aliyun.com/docker-ce/linux/centos/8/x86_64/edge/Packages/
安装containerd.io
yum install -y https://mirrors.aliyun.com/docker-ce/linux/centos/8/x86_64/edge/Packages/containerd.io-1.3.7-3.1.el8.x86_64.rpm
报错
在执行安装docker命令,出现包冲突podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
问题: problem with installed package podman-2.0.5-5.module_el8.3.0+512+b3b58dca.x86_64
替换冲突的安装包
执行以下命令没有报错
yum install -y https://mirrors.aliyun.com/docker-ce/linux/centos/8/x86_64/edge/Packages/containerd.io-1.3.7-3.1.el8.x86_64.rpm https://mirrors.aliyun.com/docker-ce/linux/centos/8/x86_64/edge/Packages/docker-ce-19.03.13-3.el8.x86_64.rpm https://mirrors.aliyun.com/docker-ce/linux/centos/8/x86_64/edge/Packages/docker-ce-cli-19.03.13-3.el8.x86_64.rpm --allowerasing
将docker设置为开机启动项
systemctl enable docker
查看开机启动项
systemctl list-unit-files | grep docker
启动docker
systemctl start docker
查看docker版本
docker -v