centos8安装docker个人记录

本文档详细介绍了如何在已停止维护的CentOS8系统中安装Docker。首先,通过修改YUM仓库地址为阿里云镜像源来解决因官方维护停止导致的问题。接着,设置Docker的存储库,选择使用阿里云的镜像。然后,通过YUM安装Docker引擎,并启动服务。最后,验证Docker安装成功并运行'hello-world'镜像以测试。
摘要由CSDN通过智能技术生成

安装请参考:Install Docker Engine on CentOS | Docker Documentation

 

一:设置存储库

 sudo yum install -y yum-utils

本人的是centos8的linux,由于centos8官方已经不在维护,出现这个错误

修改 /etc/yum.repos.d/CentOS-Linux-Extras.repo ,CentOS-Linux-BaseOS.repo,CentOS-Linux-AppStream.repo 

CentOS-Linux-Extras.repo 

baseurl=https://mirrors.aliyun.com/centos/$releasever-stream/extras/$basearch/os/

 CentOS-Linux-BaseOS.repo

baseurl=https://mirrors.aliyun.com/centos/$releasever-stream/BaseOS/$basearch/os/

CentOS-Linux-AppStream.repo 

baseurl=https://mirrors.aliyun.com/centos/$releasever-stream/AppStream/$basearch/os/
# 清除所有缓存文件
yum clean all 
# 制作元数据缓存 
yum makecache

 到此处应该就能解决此问题,如果解决不了就百度解决。

然后继续进行:

 sudo yum install -y yum-utils

设置存储库

//官方默认是国外镜像
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

设置阿里云镜像

sudo yum-config-manager \
    --add-repo \
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

 

二:安装docker引擎

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

三:启动docker

systemctl start docker

使用docker version查看是否安装成功

docker version

 四:测试hello-world

docker run hello-world

 到此处则代表安装成功。 

五:查看下载的hello-world镜像

 docker images

 六:卸载docker镜像

#卸载依赖
yum remove docker-ce docker-ce-cli containerd.io
#删除资源(默认的路径)
 sudo rm -rf /var/lib/docker

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值