#! /bin/bash centos 7
sudo yum -y update
sudo yum -y remove docker docker-common docker-selinux docker-engine
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install -y docker-ce
#启动docker
sudo systemctl start docker
# //添加开机启动
sudo systemctl enable docker
#! /bin/bash centos 8
sudo yum -y update
sudo yum -y remove docker docker-common docker-selinux docker-engine
yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce
//启动docker
systemctl start docker
//添加开机启动
systemctl enable docker
#! /bin/bash ubuntu
sudo apt update
sudo apt install docker.io docker-compose
docker -v
接下来安装docker-compose,运行命令:
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# 给docker-compose执行权限,运行命令:
chmod +x /usr/local/bin/docker-compose
# 验证是否安装成功
docker-compose --version