安装 docker-ce 时报以下错误
错误:软件包:3:docker-ce-18.09.9-3.el7.x86_64 (docker-ce-stable)
需要:libcgroup
错误:软件包:3:docker-ce-18.09.9-3.el7.x86_64 (docker-ce-stable)
需要:container-selinux >= 2:2.74
错误:软件包:containerd.io-1.6.33-3.1.el7.x86_64 (docker-ce-stable)
需要:container-selinux >= 2:2.74
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
安装组件 container-selinux >= 2:2.74
1.执行这个代码,它的意思是手动下载
wget https://vault.centos.org/7.9.2009/extras/x86_64/Packages/container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
2.执行这个代码,它的意思是安装下载的这个
rpm -ivh --nodeps container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
需要单独安装 libcgroup,其他方式安装没成功,可根据自己具体情况操作,可借助AI工具解决
1.添加阿里云的基础镜像源:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
2.更新系统源并清理缓存:
sudo yum clean all
sudo yum makecache
3.安装 libcgroup:
sudo yum install -y libcgroup
安装docker:
yum install -y docker-ce-3:19.03.9-3.el7.x86_64
配置阿里云镜像源:Docker 的配置文件通常位于 /etc/docker/daemon.json
{
"registry-mirrors": [
"https://your-mirror.aliyuncs.com"
]
}
启动并加入开机启动
systemctl start docker && systemctl enable docker