CentOS 7.6 YUM安装部署Docker-CE 18.09.0环境 | IT运维网
  • 欢迎访问本网站;本站QQ交流群:654792529;如果您觉得本站非常有看点,那么赶紧使用Ctrl+D收藏吧!
  • 本站为个人技术性博客网站,上面会更新一些系统、网络、云计算和监控等相关运维的技术性文章,供大家参考、学习和一起交流。

CentOS 7.6 YUM安装部署Docker-CE 18.09.0环境

Docker yvan 1年前 (2018-08-16) 1123次浏览 已收录 0个评论 扫描二维码

环境说明:

系统:CentOS最小化安装;升级软件补丁,内核和系统版本不升级;关闭SELinux和防火墙。
开始安装:

1、安装所需依赖:yum install -y yum-utils device-mapper-persistent-data lvm2

[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: centos.ustc.edu.cn
 * updates: mirrors.aliyun.com
base                                                                                                                                                                | 3.6 kB  00:00:00
extras                                                                                                                                                              | 3.4 kB  00:00:00
updates                                                                                                                                                             | 3.4 kB  00:00:00
(1/2): updates/7/x86_64/primary_db                                                                                                                                  | 1.4 MB  00:00:00
(2/2): extras/7/x86_64/primary_db                                                                                                                                   | 156 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-persistent-data.x86_64 0:0.7.3-3.el7 will be installed
......此处省略......
---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================================
 Package                                                   Arch                               Version                                            Repository                           Size
===========================================================================================================================================================================================
Installing:
 device-mapper-persistent-data                             x86_64                             0.7.3-3.el7                                        base                                405 k
 lvm2                                                      x86_64                             7:2.02.180-10.el7_6.2                              updates                             1.3 M
 yum-utils                                                 noarch                             1.1.31-50.el7                                      base                                121 k
Installing for dependencies:
 device-mapper-event                                       x86_64                             7:1.02.149-10.el7_6.2                              updates                             188 k
 device-mapper-event-libs                                  x86_64                             7:1.02.149-10.el7_6.2                              updates                             187 k
 libaio                                                    x86_64                             0.3.109-13.el7                                     base                                 24 k
 lvm2-libs                                                 x86_64                             7:2.02.180-10.el7_6.2                              updates                             1.1 M
 python-chardet                                            noarch                             2.2.1-1.el7_1                                      base                                227 k
 python-kitchen                                            noarch                             1.1.1-5.el7                                        base                                267 k

Transaction Summary
===========================================================================================================================================================================================
Install  3 Packages (+6 Dependent packages)

Total download size: 3.8 M
Installed size: 11 M
Downloading packages:
(1/9): device-mapper-event-1.02.149-10.el7_6.2.x86_64.rpm                                                                                                           | 188 kB  00:00:01
(2/9): device-mapper-event-libs-1.02.149-10.el7_6.2.x86_64.rpm                                                                                                      | 187 kB  00:00:01
......此处省略......
(8/9): yum-utils-1.1.31-50.el7.noarch.rpm                                                                                                                           | 121 kB  00:00:00
(9/9): python-kitchen-1.1.1-5.el7.noarch.rpm                                                                                                                        | 267 kB  00:00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                      1.9 MB/s | 3.8 MB  00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libaio-0.3.109-13.el7.x86_64                                                                                                                                            1/9
  Installing : 7:device-mapper-event-libs-1.02.149-10.el7_6.2.x86_64                                                                                                                   2/9
......此处省略......
  Verifying  : 7:device-mapper-event-libs-1.02.149-10.el7_6.2.x86_64                                                                                                                   8/9
  Verifying  : libaio-0.3.109-13.el7.x86_64                                                                                                                                            9/9

Installed:
  device-mapper-persistent-data.x86_64 0:0.7.3-3.el7                       lvm2.x86_64 7:2.02.180-10.el7_6.2                       yum-utils.noarch 0:1.1.31-50.el7

Dependency Installed:
  device-mapper-event.x86_64 7:1.02.149-10.el7_6.2    device-mapper-event-libs.x86_64 7:1.02.149-10.el7_6.2    libaio.x86_64 0:0.3.109-13.el7    lvm2-libs.x86_64 7:2.02.180-10.el7_6.2
  python-chardet.noarch 0:2.2.1-1.el7_1               python-kitchen.noarch 0:1.1.1-5.el7

Complete!

2、配置Docker阿里云YUM源并刷新缓存:yum-config-manager –add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo && yum makecache fast

[root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo && yum makecache fast
Loaded plugins: fastestmirror
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.cn99.com
 * updates: mirrors.163.com
base                                                                                                                                                                | 3.6 kB  00:00:00
docker-ce-stable                                                                                                                                                    | 3.5 kB  00:00:00
extras                                                                                                                                                              | 3.4 kB  00:00:00
updates                                                                                                                                                             | 3.4 kB  00:00:00
(1/6): base/7/x86_64/group_gz                                                                                                                                       | 166 kB  00:00:00
(2/6): docker-ce-stable/x86_64/primary_db                                                                                                                           |  19 kB  00:00:00
(3/6): docker-ce-stable/x86_64/updateinfo                                                                                                                           |   55 B  00:00:00
(4/6): extras/7/x86_64/primary_db                                                                                                                                   | 156 kB  00:00:00
(5/6): updates/7/x86_64/primary_db                                                                                                                                  | 1.4 MB  00:00:01
(6/6): base/7/x86_64/primary_db                                                                                                                                     | 6.0 MB  00:00:01
Metadata Cache Created

3、查看当前可安装所有版本:yum list docker-ce –showduplicates | sort -r

[root@localhost ~]# yum list docker-ce --showduplicates | sort -r
 * updates: mirrors.163.com
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
 * extras: mirrors.cn99.com
docker-ce.x86_64            3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64            18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.0.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            18.03.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.3.ce-1.el7                    docker-ce-stable
docker-ce.x86_64            17.03.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.0.ce-1.el7.centos             docker-ce-stable
 * base: mirrors.aliyun.com
Available Packages

4、当前较新版本为18.09.0-3;YUM安装此Docker-CE版本:yum install -y docker-ce

此时如果需要安装指定版本则执行命令:yum install -y docker-ce-18.06.1.ce

[root@localhost ~]# yum install -y docker-ce
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.cn99.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:18.09.0-3.el7 will be installed
......此处省略......
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================================
 Package                                             Arch                                Version                                       Repository                                     Size
===========================================================================================================================================================================================
Installing:
 docker-ce                                           x86_64                              3:18.09.0-3.el7                               docker-ce-stable                               19 M
Installing for dependencies:
 audit-libs-python                                   x86_64                              2.8.4-4.el7                                   base                                           76 k
 checkpolicy                                         x86_64                              2.5-8.el7                                     base                                          295 k
......此处省略......
 python-IPy                                          noarch                              0.75-6.el7                                    base                                           32 k
 setools-libs                                        x86_64                              3.3.8-4.el7                                   base                                          620 k

Transaction Summary
===========================================================================================================================================================================================
Install  1 Package (+10 Dependent packages)

Total download size: 56 M
Installed size: 241 M
Downloading packages:
(1/11): audit-libs-python-2.8.4-4.el7.x86_64.rpm                                                                                                                    |  76 kB  00:00:00
(2/11): checkpolicy-2.5-8.el7.x86_64.rpm                                                                                                                            | 295 kB  00:00:00
......此处省略......
(10/11): docker-ce-cli-18.09.0-3.el7.x86_64.rpm                                                                                                                     |  14 MB  00:00:03
(11/11): docker-ce-18.09.0-3.el7.x86_64.rpm                                                                                                                         |  19 MB  00:00:09
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                      5.8 MB/s |  56 MB  00:00:09
Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Importing GPG key 0x621E9F35:
 Userid     : "<a href="https://www.ityww.cn/tag/docker" title="查看更多关于Docker的文章" target="_blank">Docker</a> Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 From       : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : containerd.io-1.2.0-3.el7.x86_64                                                                                                                                       1/11
  Installing : 1:docker-ce-cli-18.09.0-3.el7.x86_64                                                                                                                                   2/11
......此处省略......
  Verifying  : audit-libs-python-2.8.4-4.el7.x86_64                                                                                                                                  10/11
  Verifying  : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                       11/11

Installed:
  docker-ce.x86_64 3:18.09.0-3.el7

Dependency Installed:
  audit-libs-python.x86_64 0:2.8.4-4.el7        checkpolicy.x86_64 0:2.5-8.el7           container-selinux.noarch 2:2.74-1.el7         containerd.io.x86_64 0:1.2.0-3.el7
  docker-ce-cli.x86_64 1:18.09.0-3.el7          libcgroup.x86_64 0:0.41-20.el7           libsemanage-python.x86_64 0:2.5-14.el7        policycoreutils-python.x86_64 0:2.5-29.el7
  python-IPy.noarch 0:0.75-6.el7                setools-libs.x86_64 0:3.3.8-4.el7

Complete!

5、启动Docker服务并将Docker服务配置自启动:systemctl start docker && systemctl enable docker

[root@localhost ~]# systemctl start docker && systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@localhost ~]# systemctl status docker
● docker.service - <a href="https://www.ityww.cn/tag/docker" title="查看更多关于Docker的文章" target="_blank">Docker</a> Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2018-08-16 17:03:04 CST; 15s ago
     Docs: https://docs.docker.com
 Main PID: 10718 (dockerd)
   CGroup: /system.slice/docker.service
           ├─10718 /usr/bin/dockerd -H unix://
           └─10727 containerd --config /var/run/docker/containerd/containerd.toml --log-level info

6、查看已安装Docker的版本信息:

[root@localhost ~]# docker version
Client:
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:48:22 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:19:08 2018
  OS/Arch:          linux/amd64
  Experimental:     false

IT运维网 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明CentOS 7.6 YUM安装部署Docker-CE 18.09.0环境
喜欢 (1)
[yvan.lu@ityww.cn]
分享 (0)
yvan
关于作者:
聪明来自勤奋、知识在于积累、好记性不如烂键盘!

您必须 登录 才能发表评论!