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) <[email protected]>
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
安裝完成!