centos7.2安装docker 报错 Requires: container-selinux >= 2.9
下列操作用root操作的,如果不是root请用sudo操作
1.检查内核
uname -r
查看内核是否在3.10以上
3.10.0-327.36.3.el7.x86_64
2.删除旧版本的docker
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
3.安装一些必要的系统工具
yum install -y yum-utils device-mapper-persistent-data lvm2
4.添加Docker 源仓库
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
5.安装
yum install docker-ce docker-ce-cli containerd.io
6.报错: Requires: container-selinux >= 2.9
安装Docker CE 需要依赖 container-selinux >= 2.9,我们只需要安装一下这个依赖包即可
7.安装container-selinux2.9
- wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- yum install epel-release
- yum install container-selinux
安装container-selinux 需要依赖epel源,所以这里需要先安装epel源,这里我们使用了阿里云的源仓库
如果此时出现下列信息,安装可能还会报错
我更新了下yum 便好用了,猜测是yum缓存没加进去
yum clean all
yum update
继续5操作安装,一路y ,安装成功
8.启动docker 服务
systemctl enable docker // 设置开机启动
systemctl start docker // 启动docker
systemctl status docker
看到Docker的状态信息如下:状态为running,表示docker 已经运行了