在centos6上安装docker1.12

前端之家收集整理的这篇文章主要介绍了在centos6上安装docker1.12前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

docker 1.12是今年docker迄今发布的最为重要的一个版本,它大大增强了docker的内置编排机制。在一直被诟病的集群的构成方面也交出了自己的答卷。虽然增加功能让你在使用的时候有一种在使用kubernetes的感觉,但这个世界不就是这样么,你有的我也有,我有的是原生态。闲话不说,安装。

设定Yum

docker缺省的Yum库使用的是main,基本上是稳定的版本。目前该版本为1.10。而在centos上安装只需要设定为experimental。将其baseurl设定为https://yum.dockerproject.org/repo/experimental/centos/7/即可。以后升到1.99估计也可以用同样的花招抢先试用吧。以下为设定方式:

      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      cat > /etc/yum.repos.d/docker.repo <<-EOF
    • [dockerrepo]
    • name=Docker Repository
    • baseurl=https://yum.dockerproject.org/repo/experimental/centos/7/
    • enabled=1
    • gpgcheck=1
    • gpgkey=https://yum.org/gpg
    • EOF

    确认旧的docker相关的组件并删除

    你的机器上一定有用centos简易安装方式yum install docker安装的各种docker组件。安装1.12之前先把它们删掉吧,不然后面有可能还是会提示删除的。

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    10. 10
    11. [root@host32 ~]# rpm -qa |grep docker
    12. docker-selinux-1.10.3-44.el7.centos.x86_64
    13. docker-common-.x86_64
    14. docker-forward-journald-.x86_64
    15. docker-.x86_64
    16. [root@host32 ~]#
    17. [root@host32 ~]# yum -y remove docker-selinux-1.10.3-44.el7.centos.x86_64
    18. [root@host32 ~]# yum -y remove docker-common-1.10.3-44.el7.centos.x86_64
    19. [root@host32 ~]# yum -y remove docker-forward-journald-1.10.3-44.el7.centos.x86_64
    20. [root@host32 ~]# yum -y remove docker-1.10.3-44.el7.centos.x86_64

    安装docker-engine

    安装命令:yum -y install docker-engine

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. [root@host32 ~]# yum install -y docker-engine
    64. Loaded plugins: fastestmirror,langpacks
    65. dockerrepo | 2.9 kB 00:00
    66. dockerrepo/primary_db | 49 kB 03
    67. Loading mirror speeds from cached hostfile
    68. * base: mirrors.tuna.tsinghua.edu.cn
    69. * epel: mirror.premi.st
    70. * extras: mirrors.cn
    71. * updates: mirrors.aliyun.com
    72. Resolving Dependencies
    73. --> Running transaction check
    74. ---> Package docker-engine.x86_64 0:1.12.0-1.el7.centos will be installed
    75. --> Processing Dependency: docker-engine-selinux >= .centos for package: docker-engine-.x86_64
    76. --> Running transaction check
    77. ---> Package docker-engine-selinux.noarch .centos will be installed
    78. --> Finished Dependency Resolution
    79.  
    80. Dependencies Resolved
    81.  
    82. ===================================================================================================================================================
    83. Package Arch Version Repository Size
    84. ===================================================================================================================================================
    85. Installing:
    86. docker-engine x86_64 .centos dockerrepo 19 M
    87. Installing for dependencies:
    88. docker-engine-selinux noarch 28 k
    89.  
    90. Transaction Summary
    91. ===================================================================================================================================================
    92. Install 1 Package (+1 Dependent package)
    93.  
    94. Total download size: 19 M
    95. Installed size: 79 M
    96. Downloading packages:
    97. warning: /var/cache/yum/x86_64/7/dockerrepo/packages/docker-engine-selinux-.noarch.rpm: Header V4 RSA/SHA512 Signature,key ID 2c52609d: NOKEY
    98. Public key for docker-engine-selinux-.rpm is not installed
    99. (1/2): docker-engine-selinux-.rpm | 28 kB 02
    100. (2/2): docker-engine-.x86_64.rpm | 19 MB 07:34
    101. ---------------------------------------------------------------------------------------------------------------------------------------------------
    102. Total 43 kB/s | 34
    103. Retrieving key from https://yum.org/gpg
    104. Importing GPG key 0x2C52609D:
    105. Userid : "Docker Release Tool (releasedocker) <docker@docker.com>"
    106. Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
    107. From : https://yum.org/gpg
    108. Running transaction check
    109. Running transaction test
    110. Transaction test succeeded
    111. Running transaction
    112. Installing : docker-engine-selinux-.noarch 2
    113. Installing : docker-engine-.x86_64 2
    114. Verifying : docker-engine-selinux-2
    115. Verifying : docker-engine-2
    116.  
    117. Installed:
    118. docker-engine.centos
    119.  
    120. Dependency Installed:
    121. docker-engine-selinux.centos
    122.  
    123. Complete!
    124. [root@host32 ~]#

    设定自启动

    命令:systemctl enable docker

    启动docker服务

    命令:systemctl start docker

    确认docker版本

    命令:docker info
    确认server version为1.12

    1. [root@host32 ~]# docker info
    2. Containers: 1
    3. Running: 0
    4. Paused: 0
    5. Stopped: 1
    6. Images: 3
    7. Server Version: .0
    8. Storage Driver: devicemapper
    9. Pool Name: docker-253:0-19943542-pool
    10. Pool Blocksize: 65.54 kB
    11. Base Device Size: 10.74 GB
    12. Backing Filesystem: xfs
    13. Data file: /dev/loop0
    14. Metadata file: /dev/loop1
    15. Data Space Used: 2.443 GB
    16. Data Space Total: 107.4 GB
    17. Data Space Available: 1.789 GB
    18. Metadata 3.568 MB
    19. Metadata 2.147 GB
    20. Metadata 1.789 GB
    21. Thin Pool Minimum Free Space: 10.74 GB
    22. Udev Sync Supported: true
    23. Deferred Removal Enabled: false
    24. Deferred Deletion Enabled: false
    25. Deferred Deleted Device Count: 0
    26. Data loop file: /var/lib/docker/devicemapper/devicemapper/data
    27. WARNING: Usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
    28. Metadata loop file: /var/lib/docker/devicemapper/devicemapper/Metadata
    29. Library 1.02.107-RHEL7 (2015-10-14)
    30. Logging Driver: json-file
    31. Cgroup Driver: cgroupfs
    32. Plugins:
    33. Volume: local
    34. Network: bridge null host overlay
    35. Swarm: inactive
    36. Runtimes: runc
    37. Default Runtime: runc
    38. Security Options: seccomp
    39. Kernel 3.10327.el7.x86_64
    40. Operating System: CentOS Linux 7 (Core)
    41. OSType: linux
    42. Architecture: x86_64
    43. cpus: 1
    44. Total Memory: 1.939 GiB
    45. Name: host32
    46. ID: F5ZC:SZXG:H3MC:3UHT:N3K3:XLYQ:IC6I:ZQN5:2TPK:T7RT:AIJB:Z3IM
    47. Docker Root Dir: /var/lib/docker
    48. Debug Mode (client): false
    49. Mode (server): false
    50. Registry: https://index.docker.io/v1/
    51. WARNING: bridge-nf-call-ip6tables is disabled
    52. Experimental: true
    53. Insecure Registries:
    54. 127.0.0.0/8
    55. [root@host32 ~]#
    转载自:http://blog.csdn.net/liumiaocn/article/details/52130852

    猜你在找的CentOS相关文章