CentOS安装Docker

一、系统环境

组件版本
Centos8.0.1905
Docker20.10.16

二、yum源设置

# 备份原来而皮脂
cd /etc/yum.repos.d
cp CentOS-Base.repo CentOS-Base.repo.bak
# 下载阿里云的配置
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

三、Docker安装

1、配置镜像

# 安装yum-utils
yum install yum-utils
# 设置镜像仓库地址
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

2、查看版本

yum list docker-ce --showduplicates | sort -r

在这里插入图片描述

3、安装版本

通过其完整的软件包名称安装特定版本,该软件包名称是软件包名称(docker-ce)加上版本字符串(第二列),从第一个冒号(:)一直到第一个连字符,并用连字符(-)分隔。例如:docker-ce-20.10.16。

# 指定20.10.3版本进行安装
sudo yum install --allowerasing docker-ce-20.10.16 docker-ce-cli-20.10.16 containerd.io

4、启动Docker

# 开机自启动
sudo systemctl enable docker
# 启动Docker
sudo systemctl start docker
# 验证安装
sudo docker run hello-world

四、错误总结

1、Error: Failed to synchronize cache for repo ‘AppStream’

参考第二步yum源设置
可以逐个修改CentOS-AppStream.repo、CentOS-Base.repo、CentOS-Extras.repo、CentOS-PowerTools.repo文件中的baseurl
参考链接

2、failed to set locale, defaulting to C

出现这个问题是由于系统没有正确设置locale环境, 而locale是用于设置本地环境的比如:语言、时区、数字等

echo "export LC_ALL=en_US.UTF-8"  >>  /etc/profile
source /etc/profile

参考链接

3、Error response from daemon: OCI runtime create failed: unable to retrieve OCI runtime error

runc did not terminate successfully: exit status 127

系统没有runc,需要安装libseccomp

yum install -y libseccomp-devel

参考链接

五、参考鸣谢

Centos8上安装docker

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值