更新系统 yum update
Uninstall old versions
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
Set up the repository
Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository.
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
Install Docker Engin
Install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
sudo yum install docker-ce docker-ce-cli containerd.io
设置自动启动
systemctl enable docker
启动docker
systemctl start docker
查看docker状态
systemctl status docker
安装docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
上面命令行中可以将版本号替换为最新的版本。docker官网的链接用的是github的,缺德某些地方把这个域名污染了,所以需要换成上面这个地址。
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
查看docker compose的版本
docker-compose —version
yum install git
cd /
git clone https://github.com/yeszao/dnmp.git
cd /dnmp
docker-compose up -d