centos8安装docker

安装依赖

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

添加yum源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

centos8默认使用podman代替docker
直接安装docker会出现以下错误
[root@localhost ~]# yum install docker-ce 上次元数据过期检查:0:00:13 前,执行于 2021年06月13日 星期日 16时22分32秒。 错误: 问题: package docker-ce-3:20.10.7-3.el8.x86_64 requires containerd.io >= 1.4.1, but none of the providers can be installed - package containerd.io-1.4.3-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.0-70.rc92.module_el8.4.0+673+eabfc99d.x86_64 - package containerd.io-1.4.3-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.0-70.rc92.module_el8.4.0+673+eabfc99d.x86_64 - package containerd.io-1.4.3-3.2.el8.x86_64 conflicts with runc provided by runc-1.0.0-70.rc92.module_el8.4.0+673+eabfc99d.x86_64 - package containerd.io-1.4.3-3.2.el8.x86_64 obsoletes runc provided by runc-1.0.0-70.rc92.module_el8.4.0+673+eabfc99d.x86_64 - package containerd.io-1.4.4-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.0-70.rc92.module_el8.4.0+673+eabfc99d.x86_64 - package containerd.io-1.4.4-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.0-70.rc92.module_el8.4.0+673+eabfc99d.x86_64 - package containerd.io-1.4.6-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.0-70.rc92.module_el8.4.0+673+eabfc99d.x86_64 - package containerd.io-1.4.6-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.0-70.rc92.module_el8.4.0+673+eabfc99d.x86_64 - problem with installed package buildah-1.19.7-1.module_el8.4.0+781+acf4c33b.x86_64 - package buildah-1.19.7-1.module_el8.4.0+781+acf4c33b.x86_64 requires runc >= 1.0.0-26, but none of the providers can be installed - cannot install the best candidate for the job - package runc-1.0.0-56.rc5.dev.git2abd837.module_el8.3.0+569+1bada2e4.x86_64 is filtered out by modular filtering - package runc-1.0.0-64.rc10.module_el8.4.0+522+66908d0c.x86_64 is filtered out by modular filtering - package runc-1.0.0-65.rc10.module_el8.4.0+819+4afbd1d6.x86_64 is filtered out by modular filtering - package runc-1.0.0-70.rc92.module_el8.4.0+786+4668b267.x86_64 is filtered out by modular filtering (尝试在命令行中添加 '--allowerasing' 来替换冲突的软件包 或 '--skip-broken' 来跳过无法安装的软件包 或 '--nobest' 来不只使用软件包的最佳候选)

解决办法,命令后追加 –allowerasing
yum install docker-ce docker-ce-cli containerd.io --allowerasing

或者先卸载podman
yum erase podman buildah

安装docker-ce
[root@localhost ~]# yum install docker-ce安装: docker-cex86_64 3:20.10.7-3.el8docker-ce-stable27 M 安装依赖关系: container-selinuxnoarch 2:2.158.0-1.module_el8.4.0+781+acf4c33b appstream51 k containerd.iox86_64 1.4.6-3.1.el8docker-ce-stable34 M docker-ce-clix86_64 1:20.10.7-3.el8docker-ce-stable33 M docker-ce-rootless-extras x86_64 20.10.7-3.el8docker-ce-stable 9.2 M docker-scan-pluginx86_64 0.8.0-3.el8docker-ce-stable 4.2 M fuse-overlayfsx86_64 1.4.0-2.module_el8.4.0+673+eabfc99d appstream72 k fuse3x86_64 3.2.1-12.el8baseos50 k fuse3-libsx86_64 3.2.1-12.el8baseos94 k libcgroupx86_64 0.41-19.el8baseos70 k libslirpx86_64 4.3.1-1.module_el8.4.0+575+63b40ad7 appstream69 k slirp4netnsx86_64 1.1.8-1.module_el8.4.0+641+6116a774 appstream51 k

启动并设置开机自启动
systemctl start docker systemctl enable docker

【centos8安装docker】验证安装是否成功
docker version

    推荐阅读