在RHEL上安装Docker

来源:互联网 发布:淘宝汉堡妈代购假货 编辑:程序博客网 时间:2024/05/17 05:53

安装环境

支持Docker的RHEL版本

Red Hat Enterprise Linux 7 (64-bit)Red Hat Enterprise Linux 6.5 (64-bit) 或更高版本
  • 1
  • 2
  • 3

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

# uname -r
  • 1
  • 2

安装docker

安装前的准备

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

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

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.rpm
  • 1
  • 2

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 MInstalled 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: NOKEYRetrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6Importing 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确定吗?[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      完毕!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89

2.启动docker服务:

# service docker startStarting cgconfig service:                                 [确定]Starting docker:                                       [确定]
  • 1
  • 2
  • 3
  • 4

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

# service docker statusdocker (pid  2593) 正在运行...
  • 1
  • 2
  • 3

其他一些事项

开机启动docker守护进程

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

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

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

docker版本

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

# docker versionClient version: 1.7.1Client API version: 1.19Go version (client): go1.4.2Git commit (client): 786b29d/1.7.1OS/Arch (client): linux/amd64Server version: 1.7.1Server API version: 1.19Go version (server): go1.4.2Git commit (server): 786b29d/1.7.1OS/Arch (server): linux/amd64
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

升级docker

# yum update docker-io
原创粉丝点击