第一步:删除旧版本和相关依赖,运行命令:
yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-engine
第二步,安装依赖,命令:
yum install -y yum-utils \device-mapper-persistent-data \lvm2
第三步,配置稳定的repositories,命令:
yum-config-manager \--add-repo \https://download.docker.com/linux/centos/docker-ce.repo
第四步,安装docker,命令:
yum install docker-ce docker-ce-cli containerd.io
启动:systemctl start docker
开机启动:systemctl enable docker
接下来安装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,如下: