1. 程式人生 > >Docker 1 12新功能探索(1) centos7上安裝docker1 12

Docker 1 12新功能探索(1) centos7上安裝docker1 12

這裡寫圖片描述

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

確認舊的docker相關的元件並刪除

你的機器上一定有用centos簡易安裝方式yum install docker安裝的各種docker元件。安裝1.12之前先把它們刪掉吧,不然後面有可能還是會提示你刪除的。

[[email protected] ~]# 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 [[email protected] ~]# [[email protected] ~]# yum -y remove docker-selinux-1.10.3-44.el7.centos.x86_64 [[email protected] ~]# yum -y remove docker-common-1.10.3-44.el7.centos.x86_64 [[email protected] ~]# yum -y remove docker-forward-journald-1.10.3-44.el7.centos.x86_64 [[email protected] ~]# yum -y remove docker-1.10.3-44.el7.centos.x86_64
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

安裝docker-engine

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

[[email protected] ~]# 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) <[email protected]>"
 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!
[[email protected] ~]#
  • 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

設定自啟動

命令:systemctl enable docker

啟動docker服務

命令:systemctl start docker

確認docker版本

命令:docker info
確認server version為1.12

[[email protected] ~]# 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
[[email protected] ~]#
  • 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

再分享一下我老師大神的人工智慧教程吧。零基礎!通俗易懂!風趣幽默!希望你也加入到我們人工智慧的隊伍中來!http://www.captainbed.net