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

  

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

[root@bogon docker]# uname -a

Linux bogon 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

[root@bogon docker]# cat /etc/redhat-release

CentOS release 6.6 (Final)

[root@bogon docker]# docker

bash: docker: command not found

[root@bogon docker]# yum install docker

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * epel: dl.fedoraproject.org
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
http://repos.fedorapeople.org/repos/peter/erlang/epel-6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

No package docker available.
Error: Nothing to do

[root@bogon docker]# yum install docker-io

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * epel: pubmirror1.math.uh.edu
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
http://repos.fedorapeople.org/repos/peter/erlang/epel-6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

No package docker-io available.
Error: Nothing to do


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

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


[root@bogon docker]# 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.em6i9i: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]


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

[root@bogon docker]# yum install docker-io

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                                                                                                            | 7.1 kB     00:00     
 * base: mirrors.tuna.tsinghua.edu.cn
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
epel                                                                                                                                                                                                     | 4.3 kB     00:00     
epel/primary_db                                                                                                                                                                                          | 5.9 MB     00:13     
http://repos.fedorapeople.org/repos/peter/erlang/epel-6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

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-23.el6 will be installed
---> Package lxc.x86_64 0:1.0.9-1.el6 will be installed
--> Processing Dependency: lua-lxc(x86-64) = 1.0.9-1.el6 for package: lxc-1.0.9-1.el6.x86_64
--> Processing Dependency: lua-alt-getopt for package: lxc-1.0.9-1.el6.x86_64
--> Processing Dependency: liblxc.so.1()(64bit) for package: lxc-1.0.9-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.9-1.el6 will be installed
--> Processing Dependency: lua-filesystem for package: lua-lxc-1.0.9-1.el6.x86_64
---> Package lxc-libs.x86_64 0:1.0.9-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-23.el6                                              base                                            131 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.9-1.el6                                                  epel                                             16 k
 lxc                                                       x86_64                                            1.0.9-1.el6                                                  epel                                            122 k
 lxc-libs                                                  x86_64                                            1.0.9-1.el6                                                  epel                                            257 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     00:10     
(2/7): libcgroup-0.40.rc1-23.el6.x86_64.rpm                                                                                                                                                              | 131 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.9-1.el6.x86_64.rpm                                                                                                                                                                    |  16 kB     00:00     
(6/7): lxc-1.0.9-1.el6.x86_64.rpm                                                                                                                                                                        | 122 kB     00:00     
(7/7): lxc-libs-1.0.9-1.el6.x86_64.rpm                                                                                                                                                                   | 257 kB     00:00     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                           457 kB/s | 5.1 MB     00:11     
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

Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : lxc-libs-1.0.9-1.el6.x86_64                                                                                                                                                                                  1/7
  Installing : lua-filesystem-1.4.2-1.el6.x86_64                                                                                                                                                                            2/7
  Installing : lua-lxc-1.0.9-1.el6.x86_64                                                                                                                                                                                   3/7
  Installing : libcgroup-0.40.rc1-23.el6.x86_64                                                                                                                                                                             4/7
  Installing : lua-alt-getopt-0.7.0-1.el6.noarch                                                                                                                                                                            5/7
  Installing : lxc-1.0.9-1.el6.x86_64                                                                                                                                                                                       6/7
  Installing : docker-io-1.7.1-2.el6.x86_64                                                                                                                                                                                 7/7
  Verifying  : lua-lxc-1.0.9-1.el6.x86_64                                                                                                                                                                                   1/7
  Verifying  : lxc-libs-1.0.9-1.el6.x86_64                                                                                                                                                                                  2/7
  Verifying  : lxc-1.0.9-1.el6.x86_64                                                                                                                                                                                       3/7
  Verifying  : docker-io-1.7.1-2.el6.x86_64                                                                                                                                                                                 4/7
  Verifying  : lua-alt-getopt-0.7.0-1.el6.noarch                                                                                                                                                                            5/7
  Verifying  : libcgroup-0.40.rc1-23.el6.x86_64                                                                                                                                                                             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-23.el6      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.9-1.el6      lxc.x86_64 0:1.0.9-1.el6      lxc-libs.x86_64 0:1.0.9-1.el6     

Complete!

[root@bogon docker]# docker -v

Docker version 1.7.1, build 786b29d/1.7.1



安装完成!

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐