1.更新软件包
sudo yum update
2.安装需要的软件包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 lrzsz
3.设置yum源
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
4.安装docker
sudo yum install docker-ce
5.关闭iptables
yum install iptables-services
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl stop iptables.service
systemctl disable iptables.service
6.启动和加入开机启动
sudo systemctl start docker
sudo systemctl enable docker