docker 安装及问题解决

本文档详细介绍了如何在 CentOS 系统上卸载旧版本的 Docker,并通过阿里云镜像仓库安装 Docker Engine-Community 的最新版本。步骤包括:卸载旧版 Docker,配置阿里云仓库,安装 Docker,以及测试安装是否成功。在安装过程中,还提供了针对错误的解决方法,如更新 yum 源。
摘要由CSDN通过智能技术生成

一、卸载旧版本

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

二、安装需要的安装包和配置镜像仓库

yum install -y yum-utils
#使用阿里云会快一点
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

三、安装 Docker Engine-Community

yum install docker-ce docker-ce-cli containerd.io

一路y即可

四、测试是否安装成功

docker -v
systemctl start docker
docker run hello-world

出现以下内容说明成功
运行hello-world
五、报错及解决办法
在这里插入图片描述
出现Error: Failed to download metadata for repo ‘base’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried错误时,可能是没有安装在线源,执行以下命令

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
sed -i 's/$releasever/8/g' /etc/yum.repos.d/CentOS-Base.repo
#如果安装了就更新以下
yum clean all
yum makecache
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值