1.安装依赖包

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

2.设置阿里云镜像源

sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3.安装docker-ce

sudo yum install docker-ce

4.设置开机启动docker-ce

sudo systemctl enable docker
sudo systemctl start docker

5.安装docker-compose

 

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version