centos8 如何安装 docker
1.首先 centos8 换阿里源
aliyun更新了centos8的说明:https://developer.aliyun.com/mirror/centos
a.CURL 命令从阿里云获得 CentOS-Base.repo文件
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
b.生成缓存
yum makecache
2.安装docker
官方参考地址:https://docs.docker.com/install/linux/docker-ce/centos/
里面包含包下载地址: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
安装依赖(非root使用sudo)
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
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
如果报错:package docker-ce-3:19.03.8-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
安装最新版 containerd.io
dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
再装剩下两个
sudo yum install docker-ce docker-ce-cli
3.service docker start 安装完成后启用docker服务,可运行
4. docker run hello-world 安装启动完成后运行hello-world检测是否成功