Centos 7.4 rpm 包安装 docker

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 08:47:17

运气好时非常顺利,一个 rpm 包,一执行安装,就完成了,比如今天在单位的虚拟机上。运气没那么好的时候,要手动安装一些信赖,比如下班回家后的我。感谢运气不那么好,要不然就不会整理这篇文档了。

安装包集合:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

此次安装用到了列表中的:

白天虚拟机上,竟然只安装 docker-ce-18.09.4-3.el7.x86_64.rpm 就可以了,结果晚上云服务器上陆续出现下面的问题

  1. 尝试直接安装 docker-ce-18.09.4-3.el7.x86_64.rpm

     [root@iZxxxxxwuf9Z ftp_user]# yum install ./docker-ce-18.09.4-3.el7.x86_64.rpm
     Loaded plugins: fastestmirror
     Examining ./docker-ce-18.09.4-3.el7.x86_64.rpm: 3:docker-ce-18.09.4-3.el7.x86_64
     Marking ./docker-ce-18.09.4-3.el7.x86_64.rpm to be installed
     **************此处省略一大堆输出**************
     --> Finished Dependency Resolution
     Error: Package: 3:docker-ce-18.09.4-3.el7.x86_64 (/docker-ce-18.09.4-3.el7.x86_64)
                Requires: docker-ce-cli
     Error: Package: 3:docker-ce-18.09.4-3.el7.x86_64 (/docker-ce-18.09.4-3.el7.x86_64)
                Requires: containerd.io >= 1.2.2-3
      You could try using --skip-broken to work around the problem
     ** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
     2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)
     2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)
     [root@iZxxxxxwuf9Z ftp_user]#
    
  2. 根据提示,“Requires: docker-ce-cli”“Requires: containerd.io >= 1.2.2-3”,所以安装了前面提到的另外两个 rpm 文件。

     [root@iZxxxxxwuf9Z ftp_user]# yum install containerd.io-1.2.5-3.1.el7.x86_64.rpm 
     **************此处省略一大堆输出**************
     [root@iZxxxxxwuf9Z ftp_user]# yum install docker-ce-cli-18.09.4-3.el7.x86_64.rpm 
     **************此处省略一大堆输出**************
     [root@iZxxxxxwuf9Z ftp_user]# 
    
  3. 再尝试安装 docker-ce-18.09.4-3.el7.x86_64.rpm

     [root@iZxxxxxwuf9Z ftp_user]# yum install ./docker-ce-18.09.4-3.el7.x86_64.rpm 
     Loaded plugins: fastestmirror
     Examining ./docker-ce-18.09.4-3.el7.x86_64.rpm: 3:docker-ce-18.09.4-3.el7.x86_64
     Marking ./docker-ce-18.09.4-3.el7.x86_64.rpm to be installed
     Resolving Dependencies
     **************此处省略一大堆输出**************
     Downloading packages:
     Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
    
    
     Error downloading packages:
       selinux-policy-targeted-3.13.1-229.el7_6.9.noarch: [Errno 5] [Errno 12] Cannot allocate memory
     **************此处省略一大堆输出**************
       libsepol-devel-2.5-10.el7.x86_64: [Errno 5] [Errno 12] Cannot allocate memory
    
  4. 根据提示 “because /usr/bin/applydeltarpm not installed”,所以如下操作

     [root@iZxxxxxwuf9Z ftp_user]# yum provides '*/applydeltarpm' 
     Loaded plugins: fastestmirror
     Loading mirror speeds from cached hostfile
     base/7/x86_64/filelists_db
     | 7.1 MB  00:00:00     
     epel/x86_64/filelists_db
     |  11 MB  00:00:00     
     extras/7/x86_64/filelists_db
     | 236 kB  00:00:00     
     updates/7/x86_64/filelists_db
     | 2.7 MB  00:00:00     
     deltarpm-3.6-3.el7.x86_64 : Create deltas between rpms
     Repo        : base
     Matched from:
     Filename    : /usr/bin/applydeltarpm
    

    原来是 deltarpm-3.6-3.el7.x86_64 的问题,所以继续操作

     [root@iZxxxxxwuf9Z ftp_user]# yum install deltarpm
     Loaded plugins: fastestmirror
     Loading mirror speeds from cached hostfile
     Resolving Dependencies
     --> Running transaction check
     ---> Package deltarpm.x86_64 0:3.6-3.el7 will be installed
     --> Finished Dependency Resolution
     **************此处省略一大堆输出**************                                                                                                                                                                    
     Complete!
    
  5. 最后一次尝试安装 docker-ce-18.09.4-3.el7.x86_64.rpm

     [root@iZxxxxxwuf9Z ftp_user]# yum install docker-ce-18.09.4-3.el7.x86_64.rpm 
     Loaded plugins: fastestmirror
     Examining docker-ce-18.09.4-3.el7.x86_64.rpm: 3:docker-ce-18.09.4-3.el7.x86_64
     Marking docker-ce-18.09.4-3.el7.x86_64.rpm to be installed
     Resolving Dependencies
     **************此处省略一大堆输出**************
     Complete!
     [root@iZxxxxxwuf9Z ftp_user]# 
    

愉快完成

参考:官方文档

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!