Rhel

自今晚以來未能在 RHEL 7 上安裝 Docker CE

  • February 23, 2021

我正在使用此命令在 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

所以我們剛剛在安裝和解除安裝時遇到了這個問題(昨天一切正常)。

查看您看到的錯誤程式碼:

https://download.docker.com/linux/centos/7Server/x86_64/nightly/repodata/repomd.xml: 
[Errno 14] HTTPS Error 404 - Not Found

並將這個 url 插入瀏覽器確實是 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 提供有關此問題的資訊。

引用自:https://unix.stackexchange.com/questions/611123