Docker 1.12新功能探索(1):centos7上安装docker1.12

Docker 1.12新功能探索(1):centos7上安装docker1.12_第1张图片

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

Linux 版本
CentOS 7.2

设定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) "
 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 ~]#

你可能感兴趣的:(Docker,深入浅出Docker)