阿里云服务器执行yum,一直下载docker-ce-stable失败

chr35 2024-07-23 09:37:04 阅读 50

<code>~# yum update

Docker CE Stable - x86_64 0.0 B/s | 0 B 02:00

Errors during downloading metadata for repository 'docker-ce-stable':

- Curl error (28): Timeout was reached for https://download.docker.com/linux/centos/8/x86_64/stable/repodata/repomd.xml [Connection timed out after 30000 milliseconds]

Error: Failed to download metadata for repo 'docker-ce-stable': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

这可能是由于YUM配置文件中包含了Docker仓库的配置,或者您的yum源中包含了Docker的相关依赖。您可以尝试以下步骤解决问题:

1. 查看YUM配置: 查看 `/etc/yum.repos.d/` 目录下是否有与Docker相关的repo文件,如`docker.repo`或`docker-ce.repo`,并临时移除或注释掉相关配置。

本人通过查看`/etc/yum.repos.d/` 目录,发现有docker-ce.repo,打开

[docker-ce-stable]

name=Docker CE Stable - $basearch

baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/stable

enabled=1

gpgcheck=1

gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-stable-debuginfo]

name=Docker CE Stable - Debuginfo $basearch

baseurl=https://download.docker.com/linux/centos/$releasever/debug-$basearch/stable

enabled=0

gpgcheck=1

gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-stable-source]

name=Docker CE Stable - Sources

baseurl=https://download.docker.com/linux/centos/$releasever/source/stable

enabled=0

gpgcheck=1

gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test]

name=Docker CE Test - $basearch

baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/test

enabled=0

gpgcheck=1

gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test-debuginfo]

name=Docker CE Test - Debuginfo $basearch

baseurl=https://download.docker.com/linux/centos/$releasever/debug-$basearch/test

enabled=0

gpgcheck=1

gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test-source]

name=Docker CE Test - Sources

baseurl=https://download.docker.com/linux/centos/$releasever/source/test

enabled=0

gpgcheck=1

gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly]

name=Docker CE Nightly - $basearch

baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/nightly

enabled=0

gpgcheck=1

gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly-debuginfo]

name=Docker CE Nightly - Debuginfo $basearch

baseurl=https://download.docker.com/linux/centos/$releasever/debug-$basearch/nightly

enabled=0

gpgcheck=1

gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly-source]

name=Docker CE Nightly - Sources

baseurl=https://download.docker.com/linux/centos/$releasever/source/nightly

enabled=0

gpgcheck=1

gpgkey=https://download.docker.com/linux/centos/gpg

发现第4行,enabled=1,其他都是0,将其改为0,解决

2. 临时禁用Docker源: 在执行yum命令时,可以使用`--disablerepo=docker*`参数来临时忽略Docker仓库。



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。