由于有一些软件需要运行在docker上,打算在CentOS8上安装试一下。一开始是按照菜鸟教程上的操作(curl -fsSL https://get.docker.com | bash -s docker –mirror Aliyun)来进行的,但出现下面错误:
Error:
Problem 1: problem with installed package podman-3.2.3-0.10.module_el8.4.0+886+c9a8d9ad.x86_64
- package podman-3.2.3-0.10.module_el8.4.0+886+c9a8d9ad.x86_64 requires runc >= 1.0.0-57, but none of the providers can be installed
- package podman-3.3.1-9.module_el8.5.0+988+b1f0b741.x86_64 requires runc >= 1.0.0-57, but none of the providers can be installed
- package containerd.io-1.6.8-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.0-74.rc95.module_el8.4.0+886+c9a8d9ad.x86_64
- package containerd.io-1.6.8-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.0-74.rc95.module_el8.4.0+886+c9a8d9ad.x86_64
- package containerd.io-1.6.8-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- package containerd.io-1.6.8-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- cannot install the best candidate for the job
- package runc-1.0.0-66.rc10.module_el8.5.0+1004+c00a74f5.x86_64 is filtered out by modular filtering
- package runc-1.0.0-72.rc92.module_el8.5.0+1006+8d0e68a2.x86_64 is filtered out by modular filtering
Problem 2: problem with installed package buildah-1.21.4-1.module_el8.4.0+886+c9a8d9ad.x86_64
这是因为安装了podman就不能再安装docker了,需要先卸载podman:
yum install -y -q yum-utils
+ sh -c 'yum install -y -q docker-ce docker-ce-cli containerd.io docker-scan-plugin docker-compose-plugin docker-ce-rootless-extras'
Error:
Problem 1: problem with installed package containers-common-1:1.3.1-5.module_el8.4.0+886+c9a8d9ad.x86_64
- package containers-common-1:1.3.1-5.module_el8.4.0+886+c9a8d9ad.x86_64 requires runc, but none of the providers can be installed
- package containers-common-2:1-2.module_el8.5.0+890+6b136101.noarch requires runc, but none of the providers can be installed
- package containerd.io-1.6.8-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.0-74.rc95.module_el8.4.0+886+c9a8d9ad.x86_64
- package containerd.io-1.6.8-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.0-74.rc95.module_el8.4.0+886+c9a8d9ad.x86_64
- package containerd.io-1.6.8-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- package containerd.io-1.6.8-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- 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-66.rc10.module_el8.5.0+1004+c00a74f5.x86_64 is filtered out by modular filtering
- package runc-1.0.0-72.rc92.module_el8.5.0+1006+8d0e68a2.x86_64 is filtered out by modular filtering
Problem 2: problem with installed package buildah-1.21.4-1.module_el8.4.0+886+c9a8d9ad.x86_64
这是由于安装的docker版本与系统不匹配的原因,可以手动安装与之对应的版本,先找到相应系统所在的目录,如我的为CentOS 8,对应的目录为“https://download.docker.com/linux/centos/8/x86_64/stable/Packages/”,然后在里面找到需要安装的包,应下面的命令安装就可以了。
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install https://download.docker.com/linux/centos/8/x86_64/stable/Packages/containerd.io-1.6.8-3.1.el8.x86_64.rpm --allowerasing
yum install https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-20.10.9-3.el8.x86_64.rpm --allowerasing
yum install https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-compose-plugin-2.6.0-3.el8.x86_64.rpm --allowerasing
最后启动docker服务,进行测试,添加用户:
systemctl start docker ##start docker service
docker run hello-world ###test docker
sudo gpasswd -a $USER docker ###Add the user
newgrp docke ###update the user group