centos7 yum install docker 安装错误

1、错误信息:

bash 复制代码
[root@localhost atguigu]# yum install docker
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"


 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

2、处理办法:

1. 解决 DNS 解析问题

无法解析 mirrorlist.centos.org 可能是 DNS 配置有误或者网络连接存在问题。你可以按照下面的步骤来解决:

检查网络连接

使用 ping 命令测试网络连通性:

bash

复制代码
ping www.baidu.com

如果无法 ping 通,需要检查网络配置、防火墙设置或者联系网络管理员。

检查 DNS 配置

查看 /etc/resolv.conf 文件,确认其中的 DNS 服务器配置是否正确。你可以使用以下命令查看文件内容:

bash

复制代码
cat /etc/resolv.conf

若 DNS 配置有误,可以使用公共的 DNS 服务器,例如 Google 的 8.8.8.88.8.4.4,或者阿里云的 223.5.5.5223.6.6.6。编辑 /etc/resolv.conf 文件,添加或者修改 DNS 服务器配置:

bash

复制代码
nameserver 8.8.8.8
nameserver 8.8.4.4

或者

bash

复制代码
nameserver 223.5.5.5
nameserver 223.6.6.6

2. 解决 base 仓库 baseurl 问题

可以通过替换为国内镜像源来解决这个问题,下面以阿里云镜像源为例:

备份原有的 CentOS-Base.repo 文件

bash

复制代码
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载阿里云的 CentOS-Base.repo 文件

bash

复制代码
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
清除 yum 缓存并重新生成

bash

复制代码
yum clean all
yum makecache

3. 解决仓库重复配置问题

错误信息中提到 Repository base is listed more than once in the configuration,这表明 base 仓库在配置文件中被重复列出了。你可以检查 /etc/yum.repos.d 目录下的所有 .repo 文件,确保 base 仓库只被配置了一次。

4. 再次尝试安装 Docker

完成上述操作之后,再次尝试安装 Docker:

bash

复制代码
yum install docker

3、安装成功信息:

复制代码
[root@localhost atguigu]# yum install docker
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker.x86_64.2.1.13.1-210.git7d71120.el7.centos 将被 安装
--> 正在处理依赖关系 docker-common = 2:1.13.1-210.git7d71120.el7.centos,它被软件包 2:docker-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 docker-client = 2:1.13.1-210.git7d71120.el7.centos,它被软件包 2:docker-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 subscription-manager-rhsm-certificates,它被软件包 2:docker-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 docker-client.x86_64.2.1.13.1-210.git7d71120.el7.centos 将被 安装
---> 软件包 docker-common.x86_64.2.1.13.1-210.git7d71120.el7.centos 将被 安装
--> 正在处理依赖关系 skopeo-containers >= 1:0.1.26-2,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 oci-umount >= 2:2.3.3-3,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 oci-systemd-hook >= 1:0.1.4-9,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 oci-register-machine >= 1:0-5.13,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 container-storage-setup >= 0.9.0-1,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 container-selinux >= 2:2.51-1,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
--> 正在处理依赖关系 atomic-registries,它被软件包 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64 需要
---> 软件包 subscription-manager-rhsm-certificates.x86_64.0.1.24.54-1.el7.centos 将被 安装
--> 正在检查事务
---> 软件包 atomic-registries.x86_64.1.1.22.1-33.gitb507039.el7_8 将被 安装
--> 正在处理依赖关系 python-pytoml,它被软件包 1:atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64 需要
---> 软件包 container-selinux.noarch.2.2.119.2-1.911c772.el7_8 将被 安装
---> 软件包 container-storage-setup.noarch.0.0.11.0-2.git5eaf76c.el7 将被 安装
---> 软件包 containers-common.x86_64.1.0.1.40-11.el7_8 将被 安装
--> 正在处理依赖关系 subscription-manager,它被软件包 1:containers-common-0.1.40-11.el7_8.x86_64 需要
--> 正在处理依赖关系 slirp4netns,它被软件包 1:containers-common-0.1.40-11.el7_8.x86_64 需要
--> 正在处理依赖关系 fuse-overlayfs,它被软件包 1:containers-common-0.1.40-11.el7_8.x86_64 需要
---> 软件包 oci-register-machine.x86_64.1.0-6.git2b44233.el7 将被 安装
---> 软件包 oci-systemd-hook.x86_64.1.0.2.0-1.git05e6923.el7_6 将被 安装
---> 软件包 oci-umount.x86_64.2.2.5-3.el7 将被 安装
--> 正在检查事务
---> 软件包 fuse-overlayfs.x86_64.0.0.7.2-6.el7_8 将被 安装
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.2)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.0)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3()(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
---> 软件包 python-pytoml.noarch.0.0.1.14-1.git7dea353.el7 将被 安装
---> 软件包 slirp4netns.x86_64.0.0.4.3-4.el7_8 将被 安装
---> 软件包 subscription-manager.x86_64.0.1.24.54-1.el7.centos 将被 安装
--> 正在处理依赖关系 subscription-manager-rhsm = 1.24.54,它被软件包 subscription-manager-1.24.54-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 python-dmidecode >= 3.12.2-2,它被软件包 subscription-manager-1.24.54-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 python-syspurpose,它被软件包 subscription-manager-1.24.54-1.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 fuse3-libs.x86_64.0.3.6.1-4.el7 将被 安装
---> 软件包 python-dmidecode.x86_64.0.3.12.2-4.el7 将被 安装
---> 软件包 python-syspurpose.x86_64.0.1.24.54-1.el7.centos 将被 安装
---> 软件包 subscription-manager-rhsm.x86_64.0.1.24.54-1.el7.centos 将被 安装
--> 解决依赖关系完成

依赖关系解决

=======================================================================================
 Package                       架构   版本                               源       大小
=======================================================================================
正在安装:
 docker                        x86_64 2:1.13.1-210.git7d71120.el7.centos extras   17 M
为依赖而安装:
 atomic-registries             x86_64 1:1.22.1-33.gitb507039.el7_8       extras   36 k
 container-selinux             noarch 2:2.119.2-1.911c772.el7_8          extras   40 k
 container-storage-setup       noarch 0.11.0-2.git5eaf76c.el7            extras   35 k
 containers-common             x86_64 1:0.1.40-11.el7_8                  extras   43 k
 docker-client                 x86_64 2:1.13.1-210.git7d71120.el7.centos extras  3.9 M
 docker-common                 x86_64 2:1.13.1-210.git7d71120.el7.centos extras  101 k
 fuse-overlayfs                x86_64 0.7.2-6.el7_8                      extras   54 k
 fuse3-libs                    x86_64 3.6.1-4.el7                        extras   82 k
 oci-register-machine          x86_64 1:0-6.git2b44233.el7               extras  1.1 M
 oci-systemd-hook              x86_64 1:0.2.0-1.git05e6923.el7_6         extras   34 k
 oci-umount                    x86_64 2:2.5-3.el7                        extras   33 k
 python-dmidecode              x86_64 3.12.2-4.el7                       base     83 k
 python-pytoml                 noarch 0.1.14-1.git7dea353.el7            extras   18 k
 python-syspurpose             x86_64 1.24.54-1.el7.centos               updates 277 k
 slirp4netns                   x86_64 0.4.3-4.el7_8                      extras   81 k
 subscription-manager          x86_64 1.24.54-1.el7.centos               updates 1.1 M
 subscription-manager-rhsm     x86_64 1.24.54-1.el7.centos               updates 336 k
 subscription-manager-rhsm-certificates
                               x86_64 1.24.54-1.el7.centos               updates 240 k

事务概要
=======================================================================================
安装  1 软件包 (+18 依赖软件包)

总下载量:25 M
安装大小:86 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/extras/packages/atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64.rpm 的公钥尚未安装
(1/19): atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64.rpm |  36 kB  00:00:00     
(2/19): container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch. |  35 kB  00:00:00     
(3/19): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm    |  40 kB  00:00:00     
(4/19): containers-common-0.1.40-11.el7_8.x86_64.rpm            |  43 kB  00:00:00     
(5/19): docker-1.13.1-210.git7d71120.el7.centos.x86_64.rpm      |  17 MB  00:00:00     
(6/19): docker-common-1.13.1-210.git7d71120.el7.centos.x86_64.r | 101 kB  00:00:00     
(7/19): docker-client-1.13.1-210.git7d71120.el7.centos.x86_64.r | 3.9 MB  00:00:00     
(8/19): fuse3-libs-3.6.1-4.el7.x86_64.rpm                       |  82 kB  00:00:00     
(9/19): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm                 |  54 kB  00:00:00     
(10/19): oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64.rpm   |  34 kB  00:00:00     
(11/19): oci-umount-2.5-3.el7.x86_64.rpm                        |  33 kB  00:00:00     
(12/19): python-pytoml-0.1.14-1.git7dea353.el7.noarch.rpm       |  18 kB  00:00:00     
python-dmidecode-3.12.2-4.el7.x86_64.rpm 的公钥尚未安装
(13/19): python-dmidecode-3.12.2-4.el7.x86_64.rpm               |  83 kB  00:00:00     
(14/19): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                   |  81 kB  00:00:00     
python-syspurpose-1.24.54-1.el7.centos.x86_64.rpm 的公钥尚未安装
(15/19): python-syspurpose-1.24.54-1.el7.centos.x86_64.rpm      | 277 kB  00:00:00     
(16/19): subscription-manager-1.24.54-1.el7.centos.x86_64.rpm   | 1.1 MB  00:00:00     
(17/19): subscription-manager-rhsm-certificates-1.24.54-1.el7.c | 240 kB  00:00:00     
(18/19): subscription-manager-rhsm-1.24.54-1.el7.centos.x86_64. | 336 kB  00:00:00     
(19/19): oci-register-machine-0-6.git2b44233.el7.x86_64.rpm     | 1.1 MB  00:00:01     
---------------------------------------------------------------------------------------
总计                                                      8.4 MB/s |  25 MB  00:02     
从 http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
 用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 来自       : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : subscription-manager-rhsm-certificates-1.24.54-1.el7.centos.x8    1/19 
  正在安装    : subscription-manager-rhsm-1.24.54-1.el7.centos.x86_64             2/19 
  正在安装    : python-dmidecode-3.12.2-4.el7.x86_64                              3/19 
  正在安装    : python-pytoml-0.1.14-1.git7dea353.el7.noarch                      4/19 
  正在安装    : 1:atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64             5/19 
  正在安装    : slirp4netns-0.4.3-4.el7_8.x86_64                                  6/19 
  正在安装    : container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch            7/19 
  正在安装    : 2:oci-umount-2.5-3.el7.x86_64                                     8/19 
  正在安装    : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                9/19 
  正在安装    : 1:oci-register-machine-0-6.git2b44233.el7.x86_64                 10/19 
  正在安装    : 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64               11/19 
  正在安装    : python-syspurpose-1.24.54-1.el7.centos.x86_64                    12/19 
  正在安装    : subscription-manager-1.24.54-1.el7.centos.x86_64                 13/19 
  正在安装    : fuse3-libs-3.6.1-4.el7.x86_64                                    14/19 
  正在安装    : fuse-overlayfs-0.7.2-6.el7_8.x86_64                              15/19 
  正在安装    : 1:containers-common-0.1.40-11.el7_8.x86_64                       16/19 
  正在安装    : 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64          17/19 
  正在安装    : 2:docker-client-1.13.1-210.git7d71120.el7.centos.x86_64          18/19 
  正在安装    : 2:docker-1.13.1-210.git7d71120.el7.centos.x86_64                 19/19 
  验证中      : 2:docker-client-1.13.1-210.git7d71120.el7.centos.x86_64           1/19 
  验证中      : fuse3-libs-3.6.1-4.el7.x86_64                                     2/19 
  验证中      : python-syspurpose-1.24.54-1.el7.centos.x86_64                     3/19 
  验证中      : 1:atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64             4/19 
  验证中      : 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64                5/19 
  验证中      : fuse-overlayfs-0.7.2-6.el7_8.x86_64                               6/19 
  验证中      : 2:docker-common-1.13.1-210.git7d71120.el7.centos.x86_64           7/19 
  验证中      : 2:docker-1.13.1-210.git7d71120.el7.centos.x86_64                  8/19 
  验证中      : 1:oci-register-machine-0-6.git2b44233.el7.x86_64                  9/19 
  验证中      : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch               10/19 
  验证中      : 2:oci-umount-2.5-3.el7.x86_64                                    11/19 
  验证中      : container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch           12/19 
  验证中      : slirp4netns-0.4.3-4.el7_8.x86_64                                 13/19 
  验证中      : subscription-manager-rhsm-1.24.54-1.el7.centos.x86_64            14/19 
  验证中      : python-pytoml-0.1.14-1.git7dea353.el7.noarch                     15/19 
  验证中      : subscription-manager-rhsm-certificates-1.24.54-1.el7.centos.x8   16/19 
  验证中      : 1:containers-common-0.1.40-11.el7_8.x86_64                       17/19 
  验证中      : python-dmidecode-3.12.2-4.el7.x86_64                             18/19 
  验证中      : subscription-manager-1.24.54-1.el7.centos.x86_64                 19/19 

已安装:
  docker.x86_64 2:1.13.1-210.git7d71120.el7.centos                                     

作为依赖被安装:
  atomic-registries.x86_64 1:1.22.1-33.gitb507039.el7_8                                
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8                                   
  container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7                             
  containers-common.x86_64 1:0.1.40-11.el7_8                                           
  docker-client.x86_64 2:1.13.1-210.git7d71120.el7.centos                              
  docker-common.x86_64 2:1.13.1-210.git7d71120.el7.centos                              
  fuse-overlayfs.x86_64 0:0.7.2-6.el7_8                                                
  fuse3-libs.x86_64 0:3.6.1-4.el7                                                      
  oci-register-machine.x86_64 1:0-6.git2b44233.el7                                     
  oci-systemd-hook.x86_64 1:0.2.0-1.git05e6923.el7_6                                   
  oci-umount.x86_64 2:2.5-3.el7                                                        
  python-dmidecode.x86_64 0:3.12.2-4.el7                                               
  python-pytoml.noarch 0:0.1.14-1.git7dea353.el7                                       
  python-syspurpose.x86_64 0:1.24.54-1.el7.centos                                      
  slirp4netns.x86_64 0:0.4.3-4.el7_8                                                   
  subscription-manager.x86_64 0:1.24.54-1.el7.centos                                   
  subscription-manager-rhsm.x86_64 0:1.24.54-1.el7.centos                              
  subscription-manager-rhsm-certificates.x86_64 0:1.24.54-1.el7.centos                 

完毕!
相关推荐
MarkHD2 小时前
第八天 - paramiko/ssh模块 - 远程服务器管理 - 练习:批量服务器命令执行工具
运维·服务器·ssh
GalaxyPokemon3 小时前
MySQL基础 [一] - Ubuntu版本安装
linux·运维·ubuntu
柳鲲鹏4 小时前
UBUNTU编译datalink
linux·运维·ubuntu
kfepiza4 小时前
`docker run --restart no,always,on-failure,unless-stopped`笔记250406
笔记·docker·容器
小雨凉如水5 小时前
docker 常用命令
java·docker·eureka
CaliXz5 小时前
野草云防火墙风险分析及 Docker 使用注意事项
运维·docker·容器
计算机学无涯5 小时前
Docker 命令简写配置
运维·docker·容器
黎明鱼儿5 小时前
基于 docker 的 Xinference 全流程部署指南
docker·容器·大模型·nlp·xinference
kk小源5 小时前
Docker常用操作教程
运维·docker·容器