更新linux
sudo yum update安装需要的软件包
yum-util 提供yum-config-manager功能,另两个是devicemapper驱动依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2设置yum源
中央仓库
sudo yum-config-manager --add-repo http://download.docker.com/linux/centos/docker-ce.repo阿里仓库
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo查看可用版本
sudo yum list docker-ce --showduplicates | sort -r安装
选择一个版本并安装,yum install docker-ce-版本号
sudo yum -y install docker-ce-20.10.0-3.el7 docker-ce-cli-20.10.0-3.el7 containerd.io设置开机启动
sudo systemctl enable docker sudo systemctl start docker验证是否安装成功
查看版本
运行hello-world
sudo docker run --rm hello-world
