安装环境

支持Docker的RHEL版本

Red Hat Enterprise Linux 7 (64-bit)
Red Hat Enterprise Linux 6.5 (64-bit) 或更高版本123

不论是RHEL的哪个版本,Docker都要求是64位的安装环境。RHEL 6的内核版本必须是2.6.32-431或者更高。查看内核版本:

# uname -r12

安装docker

安装前的准备

1.安装libcgroup(该软件包提供了一系列工具和库文件用于控制和管理控制组)

# rpm -ivh libcgroup-0.40.rc1-6.el6_5.1.x86_64.rpm12

libcgroup软件包下载地址:ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.5/x86_64/updates/fastbugs/libcgroup-0.40.rc1-6.el6_5.1.x86_64.rpm

2.更新yum源

# rpm -ivh epel-release-latest-6.noarch.rpm12

epel-release-latest软件包下载地址:https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

安装docker-io

1.使用yum软件包管理器安装docker-io:

# yum install docker-io
已加载插件:product-id, refresh-packagekit, security, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
设置安装进程
epel/metalink                                                                                            | 4.4 kB     00:00     
epel                                                                                                     | 4.3 kB     00:00     
epel/primary_db                                                                                          | 5.9 MB     00:02
解决依赖关系
--> 执行事务检查
---> Package docker-io.x86_64 0:1.7.1-2.el6 will be 安装
--> 处理依赖关系 lxc,它被软件包 docker-io-1.7.1-2.el6.x86_64 需要
--> 执行事务检查
---> Package lxc.x86_64 0:1.0.8-1.el6 will be 安装
--> 处理依赖关系 lua-lxc(x86-64) = 1.0.8-1.el6,它被软件包 lxc-1.0.8-1.el6.x86_64 需要
--> 处理依赖关系 lua-alt-getopt,它被软件包 lxc-1.0.8-1.el6.x86_64 需要
--> 处理依赖关系 liblxc.so.1()(64bit),它被软件包 lxc-1.0.8-1.el6.x86_64 需要
--> 执行事务检查
---> Package lua-alt-getopt.noarch 0:0.7.0-1.el6 will be 安装
---> Package lua-lxc.x86_64 0:1.0.8-1.el6 will be 安装
--> 处理依赖关系 lua-filesystem,它被软件包 lua-lxc-1.0.8-1.el6.x86_64 需要
---> Package lxc-libs.x86_64 0:1.0.8-1.el6 will be 安装
--> 执行事务检查
---> Package lua-filesystem.x86_64 0:1.4.2-1.el6 will be 安装
--> 完成依赖关系计算

依赖关系解决

================================================================================================================================
 软件包                             架构                       版本                              仓库                      大小
================================================================================================================================
正在安装:
 docker-io                          x86_64                     1.7.1-2.el6                       epel                     4.6 M
为依赖而安装:
 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

事务概要
================================================================================================================================
Install       6 Package(s)

总下载量:5.0 M
Installed size: 20 M
确定吗?[y/N]:y
下载软件包:
(1/6): docker-io-1.7.1-2.el6.x86_64.rpm                                                                  | 4.6 MB     00:04     
(2/6): lua-alt-getopt-0.7.0-1.el6.noarch.rpm                                                             | 6.9 kB     00:00     
(3/6): lua-filesystem-1.4.2-1.el6.x86_64.rpm                                                             |  24 kB     00:00     
(4/6): lua-lxc-1.0.8-1.el6.x86_64.rpm                                                                    |  16 kB     00:00     
(5/6): lxc-1.0.8-1.el6.x86_64.rpm                                                                        | 122 kB     00:00     
(6/6): lxc-libs-1.0.8-1.el6.x86_64.rpm                                                                   | 255 kB     00:00     
--------------------------------------------------------------------------------------------------------------------------------
总计                                                                                            807 kB/s | 5.0 MB     00:06     
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) 
 Package: epel-release-6-8.noarch (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
确定吗?[y/N]:y
运行 rpm_check_debug 
执行事务测试
事务测试成功
执行事务
Warning: RPMDB altered outside of yum.
  正在安装   : lxc-libs-1.0.8-1.el6.x86_64                                                                                  1/6 
  正在安装   : lua-filesystem-1.4.2-1.el6.x86_64                                                                            2/6 
  正在安装   : lua-lxc-1.0.8-1.el6.x86_64                                                                                   3/6 
  正在安装   : lua-alt-getopt-0.7.0-1.el6.noarch                                                                            4/6 
  正在安装   : lxc-1.0.8-1.el6.x86_64                                                                                       5/6 
  正在安装   : docker-io-1.7.1-2.el6.x86_64                                                                                 6/6 
  Verifying  : lxc-libs-1.0.8-1.el6.x86_64                                                                                  1/6 
  Verifying  : lua-lxc-1.0.8-1.el6.x86_64                                                                                   2/6 
  Verifying  : lxc-1.0.8-1.el6.x86_64                                                                                       3/6 
  Verifying  : docker-io-1.7.1-2.el6.x86_64                                                                                 4/6 
  Verifying  : lua-alt-getopt-0.7.0-1.el6.noarch                                                                            5/6 
  Verifying  : lua-filesystem-1.4.2-1.el6.x86_64                                                                            6/6 

已安装:
  docker-io.x86_64 0:1.7.1-2.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.8-1.el6 lxc.x86_64 0:1.0.8-1.el6
  lxc-libs.x86_64 0:1.0.8-1.el6      

完毕!1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889

2.启动docker服务:

# service docker start
Starting cgconfig service:                                 [确定]
Starting docker:                                       [确定]1234

3.确认docker服务是否运行:

# service docker status
docker (pid  2593) 正在运行...123

其他一些事项

开机启动docker守护进程

安装docker-io软件包时已创建docker服务默认开机项:

# ls -l /etc/rc5.d/S95docker 
lrwxrwxrwx. 1 root root 16 8月  31 2015 /etc/rc5.d/S95docker -> ../init.d/docker123

备注: redhat 6.6的默认启动级别是5。

docker版本

使用yum默认配置的源安装的docker版本是1.7.1:

# docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d/1.7.1
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
OS/Arch (server): linux/amd64123456789101112

升级docker

# yum update docker-io