centos8安装docker

(1)查看当前的内核版本

uname -r

(2)更新yum包(可选)

yum -y update:升级所有包同时也升级软件和系统内核

yum -y upgrade:只升级所有包,不升级软件和系统内核

(3)卸载旧版本

yum remove docker docker-common docker-selinux docker-engine

(4)安装依赖包

yum install -y yum-utils device-mapper-persistent-data lvm2

(5)设置源

yum-config-manager --add-repo http://download.docker.com/linux/centos/docker-ce.repo(中央仓库)

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo(阿里仓库)

(6)查看可选版本

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

(7)安装

yum install docker-ce-20.10.6-3.el8

(8)查看版本,设置开机启动,查看状态等

docker version

systemctl start docker

systemctl enable docker

systemctl daemon-reload

systemctl status docker