docker官方源无法使用的解决办法

使用官方源

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce

安装docker报错

Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2a03:2880:f10d:83:face:b00c:0:25de: Network is unreachable"
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2a03:2880:f10d:83:face:b00c:0:25de: Network is unreachable"
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2a03:2880:f10d:83:face:b00c:0:25de: Network is unreachable"
Trying other mirror.

https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2a03:2880:f10d:83:face:b00c:0:25de: Network is unreachable"
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2a03:2880:f10d:83:face:b00c:0:25de: Network is unreachable"
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2a03:2880:f10d:83:face:b00c:0:25de: Network is unreachable"
Trying other mirror.
^Chttps://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#56 - "Callback aborted"
Trying other mirror.

.....................

failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
 curl#7 - "Failed to connect to 2a03:2880:f10d:83:face:b00c:0:25de: Network is unreachable"
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml: [Errno 14] curl#56 - "Callback aborted"

这个问题是因为Docker官方源的问题,由于网络问题,直接使用默认的Docker源可能会很慢或无法访问。

为了解决这个问题,可以使用国内的Docker Yum源。

以下是一些常用的Docker源:

  1. 阿里云:https://mirrors.aliyun.com/docker-ce/linux/centos/7.9/x86_64/stable/
  2. 网易:http://hub-mirror.c.163.com/docker-ce/linux/centos/7.9/x86_64/stable/
  3. 中国科技大学:https://mirrors.ustc.edu.cn/docker-ce/linux/centos/7.9/x86_64/stable/

根据网络连接情况和稳定性需求选择一个合适的源,修改yum源配置文件。

 1.如果存在已有的docker Yum源,请先备份当前的Yum仓库配置文件:

sudo cp /etc/yum.repos.d/docker-ce.repo /etc/yum.repos.d/docker-ce.repo.backup

 2. 打开或创建yum源配置文件:

  sudo vi /etc/yum.repos.d/docker-ce.repo

  3. 将以下内容复制到文件中:

      以下是以阿里云Docker Yum源为例。

[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7.9/x86_64/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

保存文件并退出。

清除缓存并重新尝试安装Docker:

yum clean all
yum makecache
yum install docker-ce

#查看docker是否安装成功
docker version

启动Docker服务并设置开机自启

sudo systemctl start docker
sudo systemctl enable docker

相关推荐:

构建JDK1.8 centos7.9镜像-CSDN博客

docker和虚拟机的异同-CSDN博客

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值