
我正在使用此命令在 RHEL7 上安裝 Docker CE,但失敗並出現以下錯誤: 在完美工作了一段時間後,今晚開始了此操作:
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
知道發生了什麼變化嗎?
[pzagalsky@pzagalsky-au-rhel7-pzagalsky ~]$ sudo yum install docker-ce docker-ce-cli containerd.io
Failed to set locale, defaulting to C
https://download.docker.com/linux/centos/7Server/x86_64/nightly/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
One of the configured repositories failed (Docker CE Nightly - x86_64),
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=docker-ce-nightly ...
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 docker-ce-nightly
or
subscription-manager repos --disable=docker-ce-nightly
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=docker-ce-nightly.skip_if_unavailable=true
failure: repodata/repomd.xml from docker-ce-nightly: [Errno 256] No more mirrors to try.
https://download.docker.com/linux/centos/7Server/x86_64/nightly/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
答案1
所以我們剛剛在安裝和卸載時遇到了這個問題(昨天一切正常)。
查看錯誤代碼,您會看到:
https://download.docker.com/linux/centos/7Server/x86_64/nightly/repodata/repomd.xml:
[Errno 14] HTTPS Error 404 - Not Found
將此網址插入瀏覽器確實是 404s...在我看來,“/7Server/”位元有一個額外的伺服器...
雖然我們暫時成功地修改了它,但/etc/yum.repos.d/docker-ce.repo
事實證明我們錯誤地使用了 Centos yum 儲存庫,而我們實際上需要為我們的作業系統使用特定的儲存庫 - 在我們的例子中是 OL7。
問題的發布者也很可能使用了錯誤的 yum 儲存庫,需要使用 RHEL 儲存庫。
因此,有效的解決方法是為您的 Linux 發行版選擇正確的 yum 儲存庫,並且透過 yum 進行 docker 安裝應該可以工作。
看https://docs.docker.com/engine/install/對於大多數發行版
如果您使用雲端託管實例,那麼您可能在Linux 實例上預先配置了預設的yum 儲存庫,我們的OL7 實例就是這種情況,我們的ansible 程式碼錯誤地添加了centos yum 儲存庫,從而導致了該問題。
感謝 jsbilling 提供有關此問題的資訊。