当前位置: > Linux服务器 > Docker >

在centos6上安装docker1.12

时间:2017-01-28 16:23来源:linux.it.net.cn 作者:IT

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估计也可以用同样的花招抢先试用吧。以下为设定方式:

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.dockerproject.org/gpg
EOF

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

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

[root@host32 ~]# rpm -qa |grep docker
docker-selinux-1.10.3-44.el7.centos.x86_64
docker-common-1.10.3-44.el7.centos.x86_64
docker-forward-journald-1.10.3-44.el7.centos.x86_64
docker-1.10.3-44.el7.centos.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

[root@host32 ~]# yum install -y docker-engine
Loaded plugins: fastestmirror, langpacks
dockerrepo                                                                                                                  | 2.9 kB  00:00:00
dockerrepo/primary_db                                                                                                       |  49 kB  00:00:03
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * epel: mirror.premi.st
 * extras: mirrors.tuna.tsinghua.edu.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 >= 1.12.0-1.el7.centos for package: docker-engine-1.12.0-1.el7.centos.x86_64
--> Running transaction check
---> Package docker-engine-selinux.noarch 0:1.12.0-1.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================
 Package                                   Arch                       Version                                 Repository                      Size
===================================================================================================================================================
Installing:
 docker-engine                             x86_64                     1.12.0-1.el7.centos                     dockerrepo                      19 M
Installing for dependencies:
 docker-engine-selinux                     noarch                     1.12.0-1.el7.centos                     dockerrepo                      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-1.12.0-1.el7.centos.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
Public key for docker-engine-selinux-1.12.0-1.el7.centos.noarch.rpm is not installed
(1/2): docker-engine-selinux-1.12.0-1.el7.centos.noarch.rpm                                                                 |  28 kB  00:00:02
(2/2): docker-engine-1.12.0-1.el7.centos.x86_64.rpm                                                                         |  19 MB  00:07:34
---------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                               43 kB/s |  19 MB  00:07:34
Retrieving key from https://yum.dockerproject.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.dockerproject.org/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : docker-engine-selinux-1.12.0-1.el7.centos.noarch                                                                                1/2
  Installing : docker-engine-1.12.0-1.el7.centos.x86_64                                                                                        2/2
  Verifying  : docker-engine-selinux-1.12.0-1.el7.centos.noarch                                                                                1/2
  Verifying  : docker-engine-1.12.0-1.el7.centos.x86_64                                                                                        2/2

Installed:
  docker-engine.x86_64 0:1.12.0-1.el7.centos

Dependency Installed:
  docker-engine-selinux.noarch 0:1.12.0-1.el7.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: 1.12.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 Space Used: 3.568 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 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 Version: 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 Version: 3.10.0-327.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
Debug 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

 

或干脆直接用下面的一条命令,简单:

 

curl -sSL https://get.daocloud.io/docker | sh
适用于Ubuntu,Debian,Centos等大部分Linux,会3小时同步一次Docker官方资源

 

当然还提供了安装体验版和测试版的命令,如下:

 

curl -sSL https://get.daocloud.io/docker-experimental | sh
curl -sSL https://get.daocloud.io/docker-test | sh




(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容