在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
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • [root@host32 ~]# rpm -qa |grep docker docker-selinux-1.10.3-44.el7.centos.x86_64 docker-common-.x86_64 docker-forward-journald-.x86_64 docker-.x86_64 [root@host32 ~]# [root@host32 ~]# yum -y remove docker-selinux-1.10.3-44.el7.centos.x86_64 [root@host32 ~]# yum -y remove docker-common-1.10.3-44.el7.centos.x86_64 [root@host32 ~]# yum -y remove docker-forward-journald-1.10.3-44.el7.centos.x86_64 [root@host32 ~]# yum -y remove docker-1.10.3-44.el7.centos.x86_64

    安装docker-engine

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

      
      
  • 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
  • [root@host32 ~]# yum install -y docker-engine Loaded plugins: fastestmirror,langpacks dockerrepo | 2.9 kB 00:00 dockerrepo/primary_db | 49 kB 03 Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * epel: mirror.premi.st * extras: mirrors.cn * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package docker-engine.x86_64 0:1.12.0-1.el7.centos will be installed --> Processing Dependency: docker-engine-selinux >= .centos for package: docker-engine-.x86_64 --> Running transaction check ---> Package docker-engine-selinux.noarch .centos will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================================== Installing: docker-engine x86_64 .centos dockerrepo 19 M Installing for dependencies: docker-engine-selinux noarch 28 k Transaction Summary =================================================================================================================================================== Install 1 Package (+1 Dependent package) Total download size: 19 M Installed size: 79 M Downloading packages: warning: /var/cache/yum/x86_64/7/dockerrepo/packages/docker-engine-selinux-.noarch.rpm: Header V4 RSA/SHA512 Signature,key ID 2c52609d: NOKEY Public key for docker-engine-selinux-.rpm is not installed (1/2): docker-engine-selinux-.rpm | 28 kB 02 (2/2): docker-engine-.x86_64.rpm | 19 MB 07:34 --------------------------------------------------------------------------------------------------------------------------------------------------- Total 43 kB/s | 34 Retrieving key from https://yum.org/gpg Importing GPG key 0x2C52609D: Userid : "Docker Release Tool (releasedocker) <docker@docker.com>" Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d From : https://yum.org/gpg Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : docker-engine-selinux-.noarch 2 Installing : docker-engine-.x86_64 2 Verifying : docker-engine-selinux-2 Verifying : docker-engine-2 Installed: docker-engine.centos Dependency Installed: docker-engine-selinux.centos Complete! [root@host32 ~]#

    设定自启动

    命令:systemctl enable docker

    启动docker服务

    命令:systemctl start docker

    确认docker版本

    命令:docker info
    确认server version为1.12

    [root@host32 ~]# docker info
    Containers: 1
     Running: 0
     Paused: 0
     Stopped: 1
    Images: 3
    Server Version: .0
    Storage Driver: devicemapper
     Pool Name: docker-253:0-19943542-pool
     Pool Blocksize: 65.54 kB
     Base Device Size: 10.74 GB
     Backing Filesystem: xfs
     Data file: /dev/loop0
     Metadata file: /dev/loop1
     Data Space Used: 2.443 GB
     Data Space Total: 107.4 GB
     Data Space Available: 1.789 GB
     Metadata 3.568 MB
     Metadata 2.147 GB
     Metadata 1.789 GB
     Thin Pool Minimum Free Space: 10.74 GB
     Udev Sync Supported: true
     Deferred Removal Enabled: false
     Deferred Deletion Enabled: false
     Deferred Deleted Device Count: 0
     Data loop file: /var/lib/docker/devicemapper/devicemapper/data
     WARNING: Usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
     Metadata loop file: /var/lib/docker/devicemapper/devicemapper/Metadata
     Library 1.02.107-RHEL7 (2015-10-14)
    Logging Driver: json-file
    Cgroup Driver: cgroupfs
    Plugins:
     Volume: local
     Network: bridge null host overlay
    Swarm: inactive
    Runtimes: runc
    Default Runtime: runc
    Security Options: seccomp
    Kernel 3.10327.el7.x86_64
    Operating System: CentOS Linux 7 (Core)
    OSType: linux
    Architecture: x86_64
    cpus: 1
    Total Memory: 1.939 GiB
    Name: host32
    ID: F5ZC:SZXG:H3MC:3UHT:N3K3:XLYQ:IC6I:ZQN5:2TPK:T7RT:AIJB:Z3IM
    Docker Root Dir: /var/lib/docker
    Debug Mode (client): false
    Mode (server): false
    Registry: https://index.docker.io/v1/
    WARNING: bridge-nf-call-ip6tables is disabled
    Experimental: true
    Insecure Registries:
     127.0.0.0/8
    [root@host32 ~]#
    转载自:http://blog.csdn.net/liumiaocn/article/details/52130852 原文链接:https://www.f2er.com/centos/381056.html

    猜你在找的CentOS相关文章