CentOS8安装Docker报错以及解决

CentOS8安装Docker报错

CentOS8安装Docker出现package docker-ce-3:19.03.8-3.el7.x86_64 requires containerd.io >= 1.2.2-3

使用了CentOS8,尝试安装Docker时出现了错误,故及时记录一下。

错误提示

1
2
3
4
5
6
7
8
9
Problem: package docker-ce-3:19.03.8-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
- cannot install the best candidate for the job
- package containerd.io-1.2.10-3.2.el7.x86_64 is excluded
- package containerd.io-1.2.13-3.1.el7.x86_64 is excluded
- package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
- package containerd.io-1.2.2-3.el7.x86_64 is excluded
- package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
- package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
- package containerd.io-1.2.6-3.3.el7.x86_64 is excluded

问题分析

centos8默认使用podman代替docker,所以需要containerd.io,那我们就安装一下就好了

解决方法

安装containerd.io即可

1
yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm

然后继续安装Docker

docker安装的一些依赖

1
yum install -y yum-utils device-mapper-persistent-data lvm2

增加yum仓库

1
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
1
yum install -y docker-ce

若此步报错如下

1
(尝试在命令行中添加 '--allowerasing' 来替换冲突的软件包 或 '--skip-broken' 来跳过无法安装的软件包 或 '--nobest' 来不只使用最佳选择的软件包)

尝试执行

1
yum install -y --allowerasing docker-ce

启动docker

1
systemctl start docker

设置开机启动

1
systemctl enable docker
继开 wechat
欢迎加我的微信,共同交流技术