1. 程式人生 > >Centos 7.2.1511版本安裝docker碰到的問題

Centos 7.2.1511版本安裝docker碰到的問題

在Centos 7.2.1511上安裝docker上碰到如下問題

[[email protected] ~]# yum install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
Loaded plugins: fastestmirror, versionlock
docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm                                                                                                       |  28
kB 00:00:00 Examining /var/tmp/yum-root-mI2l3n/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm: docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch Marking /var/tmp/yum-root-mI2l3n/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package docker-ce-selinux.noarch
0:17.03.2.ce-1.el7.centos will be installed --> Processing Dependency: selinux-policy-base >= 3.13.1-102 for package: docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch base | 3.6
kB 00:00:00 docker-ce-edge | 2.9 kB 00:00:00 docker-ce-stable | 2.9 kB 00:00:00 extras | 3.4 kB 00:00:00 puppetlabs-deps | 2.9 kB 00:00:00 puppetlabs-products | 2.9 kB 00:00:00 tools | 2.9 kB 00:00:00 updates-released | 3.4 kB 00:00:00 Loading mirror speeds from cached hostfile --> Processing Dependency: selinux-policy-targeted >= 3.13.1-102 for package: docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch --> Finished Dependency Resolution Error: Package: docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch (/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch) Requires: selinux-policy-targeted >= 3.13.1-102 Installed: selinux-policy-targeted-3.13.1-60.el7_2.9.noarch (@updates-released) selinux-policy-targeted = 3.13.1-60.el7_2.9 Available: selinux-policy-targeted-3.13.1-60.el7.noarch (base) selinux-policy-targeted = 3.13.1-60.el7 Available: selinux-policy-targeted-3.13.1-60.el7_2.3.noarch (updates-released) selinux-policy-targeted = 3.13.1-60.el7_2.3 Available: selinux-policy-targeted-3.13.1-60.el7_2.7.noarch (updates-released) selinux-policy-targeted = 3.13.1-60.el7_2.7 Error: Package: docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch (/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch) Requires: selinux-policy-base >= 3.13.1-102 Installed: selinux-policy-targeted-3.13.1-60.el7_2.9.noarch (@updates-released) selinux-policy-base = 3.13.1-60.el7_2.9 Available: selinux-policy-minimum-3.13.1-60.el7.noarch (base) selinux-policy-base = 3.13.1-60.el7 Available: selinux-policy-minimum-3.13.1-60.el7_2.3.noarch (updates-released) selinux-policy-base = 3.13.1-60.el7_2.3 ▽ Available: selinux-policy-minimum-3.13.1-60.el7_2.7.noarch (updates-released) selinux-policy-base = 3.13.1-60.el7_2.7 Available: selinux-policy-minimum-3.13.1-60.el7_2.9.noarch (updates-released) selinux-policy-base = 3.13.1-60.el7_2.9 Available: selinux-policy-mls-3.13.1-60.el7.noarch (base) selinux-policy-base = 3.13.1-60.el7 Available: selinux-policy-mls-3.13.1-60.el7_2.3.noarch (updates-released) selinux-policy-base = 3.13.1-60.el7_2.3 Available: selinux-policy-mls-3.13.1-60.el7_2.7.noarch (updates-released) selinux-policy-base = 3.13.1-60.el7_2.7 ▽ Available: selinux-policy-mls-3.13.1-60.el7_2.9.noarch (updates-released) selinux-policy-base = 3.13.1-60.el7_2.9 ▽ [base] Available: selinux-policy-targeted-3.13.1-60.el7.noarch (base) selinux-policy-base = 3.13.1-60.el7 Available: selinux-policy-targeted-3.13.1-60.el7_2.3.noarch (updates-released) selinux-policy-base = 3.13.1-60.el7_2.3 Available: selinux-policy-targeted-3.13.1-60.el7_2.7.noarch (updates-released) selinux-policy-base = 3.13.1-60.el7_2.7 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest

經過一番搜尋,發現是系統的base.repo的問題
下面是上網查到的問題

This directory (and version of CentOS) is deprecated.  For normal users,
you should use /7/ and not /7.2.1511/ in your path. Please see this FAQ
concerning the CentOS release scheme:

https://wiki.centos.org/FAQ/General

If you know what you are doing, and absolutely want to remain at the 7.2.1511
level, go to http://vault.centos.org/ for packages. 

Please keep in mind that 7.2.1511 no longer gets any updates, nor
any security fix's.

這時候檢視base.repo
vim /etc/yum.repos.d/base.repo

[base]
name=CentOS 7.2.1511 - x86_64 - Base
baseurl=http://repo.ops.aaa.com/yum/centos/7.2.1511/base/x86_64/
enabled=1
gpgcheck=0

現在只需要把這裡面的版本7.2.1511改成7就好了

[base]
name=CentOS 7.2.1511 - x86_64 - Base
baseurl=http://repo.ops.aaa.com/yum/centos/7/base/x86_64/
enabled=1
gpgcheck=0

docker install in centos 7

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

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

yum-config-manager --enable docker-ce-edge

yum install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm

yum install docker-ce-17.03.2.ce-1.el7.centos

curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +7 /usr/local/bin/docker-compose
mkdir /usr/local/tmpdir
vim ~/.bashrc
(Add the next sentence to the end)
export TMP=/usr/local/tmpdir


source ~/.bashrc