Centos6.7安装docker1.7.1

  Docker当前发布的最新版本已经到了1.11,其官网上针对Centos的的安装需求如下:

Docker requires a 64-bit installation regardless of your CentOS version. Also, your kernel must be 3.10 at minimum, which CentOS 7 runs.

看来如果我们想在低于3.x内核的操作系统(比如Centos6.7)上装Docker最新版,势必要升级内核了。且不说升级内核步骤繁琐、容易出错,单就这种比较怪异的搭配:Centos6.x + Kerneol3.X + Docker1.11,就没有人能够保证其稳定性。故我的建议是设法在Centos6.7上安装较低版本的Docker。事实上,对于内核版本要大于3.10这个要求,是从Docker1.8.2版本开始的,Docker之前的版本是可以运行在较低内核版本之上的,比如1.7.1。

  

  首先,看下我的操作环境以及直接安装Docker的现象:

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# cat /etc/redhat-release 
CentOS release 6.7 (Final)
[root@localhost ~]# docker 
-bash: docker: command not found
[root@localhost ~]# yum install docker
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
base                                  | 3.7 kB     00:00     
base/primary_db                       | 4.6 MB     00:08     
extras                                | 3.4 kB     00:00     
extras/primary_db                     |  37 kB     00:00     
updates                               | 3.4 kB     00:00     
updates/primary_db                    | 5.2 MB     00:55     
No package docker available.
Error: Nothing to do
[root@localhost ~]# yum install docker-io
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Determining fastest mirrors
 * base: mirrors.zju.edu.cn
 * extras: mirrors.skyshe.cn
 * updates: mirrors.zju.edu.cn
No package docker-io available.
Error: Nothing to do

可以看到,在Centos6.7的标准yum源中已经没有Docker的安装包了,这时,我们需要安装EPEL。

  EPEL(Extra Packages for Enterprise Linux),企业版Linux额外包,RHEL分布非标准包的社区类库。安装如下:

[root@localhost ~]# rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.sA7VqQ: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

  

  接下来安装Docker1.7.1,在1.7.1中,安装包名称为docker-io,故我们的安装命令如下:

[root@localhost ~]# yum install docker-io
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                                           | 5.3 kB     00:00     
 * base: mirrors.zju.edu.cn
 * epel: ftp.cuhk.edu.hk
 * extras: mirrors.skyshe.cn
 * updates: mirrors.zju.edu.cn
epel                                                                    | 4.3 kB     00:00     
epel/primary_db                                                         | 5.9 MB     00:49     
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:1.7.1-2.el6 will be installed
--> Processing Dependency: lxc for package: docker-io-1.7.1-2.el6.x86_64
--> Processing Dependency: libcgroup for package: docker-io-1.7.1-2.el6.x86_64
--> Running transaction check
---> Package libcgroup.x86_64 0:0.40.rc1-17.el6_7 will be installed
---> Package lxc.x86_64 0:1.0.8-1.el6 will be installed
--> Processing Dependency: lua-lxc(x86-64) = 1.0.8-1.el6 for package: lxc-1.0.8-1.el6.x86_64
--> Processing Dependency: lua-alt-getopt for package: lxc-1.0.8-1.el6.x86_64
--> Processing Dependency: liblxc.so.1()(64bit) for package: lxc-1.0.8-1.el6.x86_64
--> Running transaction check
---> Package lua-alt-getopt.noarch 0:0.7.0-1.el6 will be installed
---> Package lua-lxc.x86_64 0:1.0.8-1.el6 will be installed
--> Processing Dependency: lua-filesystem for package: lua-lxc-1.0.8-1.el6.x86_64
---> Package lxc-libs.x86_64 0:1.0.8-1.el6 will be installed
--> Running transaction check
---> Package lua-filesystem.x86_64 0:1.4.2-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================
 Package               Arch            Version             Repository    Size
===================================================================================
Installing:
 docker-io             x86_64          1.7.1-2.el6         epel          4.6 M
Installing for dependencies:
 libcgroup             x86_64          0.40.rc1-17.el6_7   updates       129 k
 lua-alt-getopt        noarch          0.7.0-1.el6         epel          6.9 k
 lua-filesystem        x86_64          1.4.2-1.el6         epel          24 k
 lua-lxc               x86_64          1.0.8-1.el6         epel          16 k
 lxc                   x86_64          1.0.8-1.el6         epel          122 k
 lxc-libs              x86_64          1.0.8-1.el6         epel          255 k

Transaction Summary
====================================================================================
Install       7 Package(s)

Total download size: 5.1 M
Installed size: 20 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): docker-io-1.7.1-2.el6.x86_64.rpm                                   | 4.6 MB     01:09     
(2/7): libcgroup-0.40.rc1-17.el6_7.x86_64.rpm                             | 129 kB     00:00     
(3/7): lua-alt-getopt-0.7.0-1.el6.noarch.rpm                              | 6.9 kB     00:00     
(4/7): lua-filesystem-1.4.2-1.el6.x86_64.rpm                              |  24 kB     00:00     
(5/7): lua-lxc-1.0.8-1.el6.x86_64.rpm                                     |  16 kB     00:00     
(6/7): lxc-1.0.8-1.el6.x86_64.rpm                                         | 122 kB     00:01     
(7/7): lxc-libs-1.0.8-1.el6.x86_64.rpm                                    | 255 kB     00:08     
----------------------------------------------------------------------------------------------
Total                                                          64 kB/s | 5.1 MB     01:21     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid : EPEL (6) <epel@fedoraproject.org>
 Package: epel-release-6-8.noarch (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
 Package: centos-release-6-7.el6.centos.12.3.x86_64 (@anaconda-CentOS-201508042137.x86_64/6.7)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : lxc-libs-1.0.8-1.el6.x86_64                                              1/7 
  Installing : lua-filesystem-1.4.2-1.el6.x86_64                                        2/7 
  Installing : lua-lxc-1.0.8-1.el6.x86_64                                               3/7 
  Installing : lua-alt-getopt-0.7.0-1.el6.noarch                                        4/7 
  Installing : lxc-1.0.8-1.el6.x86_64                                                   5/7 
  Installing : libcgroup-0.40.rc1-17.el6_7.x86_64                                       6/7 
  Installing : docker-io-1.7.1-2.el6.x86_64                                             7/7 
  Verifying  : lxc-libs-1.0.8-1.el6.x86_64                                              1/7 
  Verifying  : libcgroup-0.40.rc1-17.el6_7.x86_64                                       2/7 
  Verifying  : lua-lxc-1.0.8-1.el6.x86_64                                               3/7 
  Verifying  : lxc-1.0.8-1.el6.x86_64                                                   4/7 
  Verifying  : docker-io-1.7.1-2.el6.x86_64                                             5/7 
  Verifying  : lua-alt-getopt-0.7.0-1.el6.noarch                                        6/7 
  Verifying  : lua-filesystem-1.4.2-1.el6.x86_64                                        7/7 

Installed:
  docker-io.x86_64 0:1.7.1-2.el6

Dependency Installed:
  libcgroup.x86_64 0:0.40.rc1-17.el6_7
  lua-alt-getopt.noarch 0:0.7.0-1.el6
  lua-filesystem.x86_64 0:1.4.2-1.el6
  lua-lxc.x86_64 0:1.0.8-1.el6
  lxc.x86_64 0:1.0.8-1.el6
  lxc-libs.x86_64 0:1.0.8-1.el6 

Complete!
[root@localhost ~]# docker -v
Docker version 1.7.1, build 786b29d/1.7.1


安装完成!

 

posted @ 2016-05-06 09:44  振宇要低调  阅读(14221)  评论(3编辑  收藏  举报