1.安装条件
检查Linux内核版本,大于3.10即可
uname -r
[root@supply-40b-712 centos]# uname -r
3.10.0-514.el7.x86_64
2.配置yum仓库
tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
3.安装
yum install -y docker-engine
安装日志如下,
已加载插件:fastestmirror
base | 3.6 kB 00:00
dockerrepo | 2.9 kB 00:00
epel | 4.7 kB 00:00
extras | 3.4 kB 00:00
kvm | 2.9 kB 00:00
openstack | 2.9 kB 00:00
salt-2018.3.3 | 2.9 kB 00:00
updates | 3.4 kB 00:00
dockerrepo/7/primary_db | 34 kB 00:01
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker-engine.x86_64.0.17.05.0.ce-1.el7.centos 将被 安装
--> 正在处理依赖关系 docker-engine-selinux >= 17.05.0.ce-1.el7.centos,它被软件包 docker-engine-17.05.0.ce-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 libseccomp.so.2()(64bit),它被软件包 docker-engine-17.05.0.ce-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 libltdl.so.7()(64bit),它被软件包 docker-engine-17.05.0.ce-1.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 docker-engine-selinux.noarch.0.17.05.0.ce-1.el7.centos 将被 安装
---> 软件包 libseccomp.x86_64.0.2.3.1-3.el7 将被 安装
---> 软件包 libtool-ltdl.x86_64.0.2.4.2-22.el7_3 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
docker-engine x86_64 17.05.0.ce-1.el7.centos dockerrepo 19 M
为依赖而安装:
docker-engine-selinux noarch 17.05.0.ce-1.el7.centos dockerrepo 28 k
libseccomp x86_64 2.3.1-3.el7 base 56 k
libtool-ltdl x86_64 2.4.2-22.el7_3 base 49 k
事务概要
================================================================================
安装 1 软件包 (+3 依赖软件包)
总下载量:20 M
安装大小:70 M
Downloading packages:
(1/4): libseccomp-2.3.1-3.el7.x86_64.rpm | 56 kB 00:00
(2/4): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm | 49 kB 00:00
warning: /var/cache/yum/x86_64/7/dockerrepo/packages/docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch.rpm 的公钥尚未安装
(3/4): docker-engine-selinux-17.05.0.ce-1.el7.centos.noarc | 28 kB 00:00
(4/4): docker-engine-17.05.0.ce-1.el7.centos.x86_64.rpm 43% [================================= (4/4): docker-engine-17.05.0.ce-1.el7.centos.x86_64.rpm 43% [=================================- (4/4): docker-engine-17.05.0.ce-1.el7.centos.x86_64.rpm 43% [=================================- (4/4): docker-engine-17.05.0.ce-1.el7.centos.x86_64.rpm | 19 MB 02:34
--------------------------------------------------------------------------------
总计 130 kB/s | 20 MB 02:34
从 https://yum.dockerproject.org/gpg 检索密钥
导入 GPG key 0x2C52609D:
用户ID : "Docker Release Tool (releasedocker) <docker@docker.com>"
指纹 : 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
来自 : https://yum.dockerproject.org/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch 1/4
libsemanage.semanage_direct_install_info: Overriding docker module at lower priority 100 with module at priority 400.
restorecon: lstat(/var/lib/docker) failed: No such file or directory
warning: %post(docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch) scriptlet failed, exit status 255
Non-fatal POSTIN scriptlet failure in rpm package docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch
正在安装 : libtool-ltdl-2.4.2-22.el7_3.x86_64 2/4
正在安装 : libseccomp-2.3.1-3.el7.x86_64 3/4
正在安装 : docker-engine-17.05.0.ce-1.el7.centos.x86_64 4/4
验证中 : libseccomp-2.3.1-3.el7.x86_64 1/4
验证中 : libtool-ltdl-2.4.2-22.el7_3.x86_64 2/4
验证中 : docker-engine-17.05.0.ce-1.el7.centos.x86_64 3/4
验证中 : docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch 4/4
已安装:
docker-engine.x86_64 0:17.05.0.ce-1.el7.centos
作为依赖被安装:
docker-engine-selinux.noarch 0:17.05.0.ce-1.el7.centos
libseccomp.x86_64 0:2.3.1-3.el7
libtool-ltdl.x86_64 0:2.4.2-22.el7_3
完毕!
4.启动
systemctl start docker.service
5.测试
docker version
Client:
Version: 17.05.0-ce
API version: 1.29
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:06:25 2017
OS/Arch: linux/amd64
Server:
Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:06:25 2017
OS/Arch: linux/amd64
Experimental: false
6.镜像测试–hello-world
docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
6.镜像安装–Dejavu(Elasticsearch数据可视化)
docker run -p 1358:1358 -d appbaseio/dejavu:2.0.5
Unable to find image 'appbaseio/dejavu:2.0.5' locally
2.0.5: Pulling from appbaseio/dejavu
605ce1bd3f31: Pull complete
fa1c60c0ad3a: Pull complete
2d304d3508a3: Pull complete
faf178ecefca: Pull complete
0a0b3ebfa7de: Pull complete
5e58cead4ca9: Pull complete
90210b4a56ba: Pull complete
001d3ef58748: Pull complete
82e5f0cc543c: Pull complete
d686453c77b4: Pull complete
Digest: sha256:9c4735243db88765e66f997c8e1ddb13726fcf9b6452aef2ec76d22764297675
Status: Downloaded newer image for appbaseio/dejavu:2.0.5
8ceccc79a2da58195816d20416848a112855d7790300dd42d9e95ce070bcaa29
7.Dejavu视图
浏览器输入http://X.X.X.X:1358/,查看界面