CentOS 7 下 docker-ce-stable: [Errno 256]

CentOS 7 下 docker-ce-stable: [Errno 256]

报错信息 – docker-ce-stable: [Errno 256] No more mirrors to try

[root@k1 ~]# yum makecache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
base                                                                                           | 3.6 kB  00:00:00     
https://download.docker.com/linux/rhel/7/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article 

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.



 One of the configured repositories failed (Docker CE Stable - 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-stable ...

     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-stable
        or
            subscription-manager repos --disable=docker-ce-stable

     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-stable.skip_if_unavailable=true

failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
https://download.docker.com/linux/rhel/7/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

解决办法 – 更改 docker-ce.repo 内容

更改前
baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/stable
更改后
baseurl=https://download.docker.com/linux/rhel/7/$basearch/stable
命令行修改
sed -i 's)centos/$releasever)7)g' /etc/yum.repos.d/docker-ce.repo
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 1. 卸载旧版本的Docker 如果您已经安装了旧版本的Docker,需要先卸载旧版本的Docker。 sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine 2. 安装必要的软件包 sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2 3. 添加Docker的官方GPG密钥 sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo 4. 安装Docker CE sudo yum install docker-ce docker-ce-cli containerd.io 5. 启动Docker sudo systemctl start docker 6. 验证Docker是否安装成功 sudo docker run hello-world 如果您看到了以下输出,则说明Docker已经成功安装并运行: Hello from Docker! This message shows that your installation appears to be working correctly. 7. 设置Docker开机自启 sudo systemctl enable docker 现在,您已经成功地在CentOS 7上安装了Docker CE。 ### 回答2: CentOS7是一种常见的Linux操作系统。Docker CE是一种流行的容器化平台。本文将介绍如何在CentOS7上安装Docker CE。 1. 升级和安装必要的软件包 首先,更新系统并安装必要的软件包: sudo yum update sudo yum install -y yum-utils device-mapper-persistent-data lvm2 2. 添加Docker CE的yum软件源 添加Docker CE的yum软件源到系统中: sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 3. 安装Docker CE 运行以下命令以安装最新版本的Docker CE: sudo yum install docker-ce 4. 启动Docker服务 启动Docker服务: sudo systemctl start docker 使用以下命令验证Docker是否已正确安装: sudo docker run hello-world 这将启动一个测试容器并输出一些信息。 5. 设置Docker服务自启动 配置Docker服务在机器启动时自动启动: sudo systemctl enable docker 完成以上步骤后,便成功将Docker CE安装在CentOS7上,并可以使用您的容器运行镜像。 注:如果您使用的是具有安全策略和防火墙规则的Linux,需要调整这些规则才能运行Docker和容器。 ### 回答3: CentOS 7是一种流行的Linux操作系统版本,适用于服务器和云计算环境。Docker CE是一个开源的容器平台,可以轻松地打包应用程序和依赖项,并运行在任何地方,而不必担心与操作系统的兼容性问题。在本文中,我们将向您介绍如何在CentOS 7上安装Docker CE。 步骤1: 升级系统 在开始安装之前,我们必须要确保我们使用的是最新的软件包和依赖项。运行以下命令可以升级CentOS 7系统。 sudo yum update -y 步骤2: 安装必备软件包 在安装Docker CE之前,我们必须先安装一些必备的软件包,比如yum-utils,用于管理Docker软件包的特定仓库。 sudo yum install -y yum-utils device-mapper-persistent-data lvm2 步骤3: 添加docker-ce的仓库 Docker CE软件包不在默认的CentOS 7存储库中。因此,我们需要手动添加Docker CE仓库。通过运行以下命令可以添加Docker CE官方仓库到CentOS 7系统中。 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 步骤4: 安装Docker CE 添加完Docker CE仓库之后,我们可以安装Docker CE了。以下命令可以安装Docker CE。 sudo yum install -y docker-ce 安装完成后,我们可以通过以下命令启动Docker CE服务,并使其在系统启动时自动启动。 sudo systemctl start docker sudo systemctl enable docker 步骤5: 验证Docker CE 安装完成后,我们可以使用以下命令来验证Docker是否成功安装。 docker version 这会显示Docker CE的版本号和相关信息。 至此,CentOS 7上的Docker CE安装已成功完成。现在您可以开始构建和管理容器了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值