第一步:安装必要的系统工具
yum update
yum install -y yum-utils device-mapper-persistent-data lvm2
第二步:添加软件源地址信息
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
第三步:更新并安装Docker-CE
yum makecache
yum -y install docker-ce
如有遇到此错误:
错误:
Error:
Problem: package docker-ce-3:20.10.2-3.el7.x86_64 requires containerd.io >= 1.4.1, but none of the providers can be installed
- cannot install the best candidate for the job
- package containerd.io-1.4.3-3.1.el7.x86_64 is filtered out by modular filtering
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
请使用
dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.4.3-3.1.el7.x86_64.rpm
请对照提示的版本下载
第四步:开启Docker服务
service docker start
第五步、测试是否安装成功
docker -v