今天在redhat上安装docker-ce报错cont9ainer-selinux >=2.9 ,在网上找了好多文章都说要安装cont9ainer-selinux,但是安装cont9ainer-selinux的时候又报如下错误
error: Failed dependencies:
policycoreutils-python is needed by container-selinux-2:1.12.5-14.el7.x86_64
还有些教程说指定其它的yum源然后安装,指定了也是报一大堆错误。
折腾了老半天终于安装好了docker-ce因此在这里记录一下希望能帮助到一些遇到同样问题的人。
下载地址:
2.下载docker安装包
下载地址:
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/下载docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm
rpm -ivh container-selinux-1.12xxx
但是又报如下错误:
warning: container-selinux-1.12.5-14.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
error: Failed dependencies:
policycoreutils-python is needed by container-selinux-2:1.12.5-14.el7.x86_64
4.下载依赖包
audit-libs-python-2.8.1-3.el7.x86_64.rpm
checkpolicy-2.5-6.el7.x86_64.rpm
libcgroup-0.41-15.el7.x86_64.rpm
libseccomp-2.3.1-3.el7.x86_64.rpm
libsemanage-python-2.5-11.el7.x86_64.rpm
policycoreutils-python-2.5-22.el7.x86_64.rpm
python-IPy-0.75-6.el7.noarch.rpm
setools-libs-3.3.8-2.el7.x86_64.rpm
打包下载地址https://download.csdn.net/download/aiceflower/10651110
也可以单独查找下载,然后安装。
5.安装依赖包
将上述下载放至dep目录下,或解压打包下载的文件( tar -zxvf dependencepackage.tar.gz )
安装:
rpm -ivh dep/*.rpm
warning: dep/audit-libs-python-2.8.1-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:setools-libs-3.3.8-2.el7 ################################# [ 14%]
2:python-IPy-0.75-6.el7 ################################# [ 29%]
3:libsemanage-python-2.5-11.el7 ################################# [ 43%]
4:libcgroup-0.41-15.el7 ################################# [ 57%]
5:checkpolicy-2.5-6.el7 ################################# [ 71%]
6:audit-libs-python-2.8.1-3.el7 ################################# [ 86%]
7:policycoreutils-python-2.5-22.el7################################# [100%]
6.再次安装container-selinux-2.9-4
rpm -ivh container-selinux-2.9-4.el7.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:container-selinux-2.9-4.el7.noarch################################# [100%]
7.安装docker-ce
rpm -ivh docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:docker-ce-17.12.0.ce-1.el7.centos################################# [100%]
8.启动docker
systemctl start docker
9.运行hello-world
docker run hello-world
出错
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
运行这句:
docker run ubuntu:15.10 /bin/echo "Hello world"
输出:
[root@localhost docker]# docker run ubuntu:15.10 /bin/echo "Hello world"
Hello world
至此docker-ce安装成功。