install docker
### 步骤2: docker和docker-compose 安装
##### 2.1 docker安装 (centos7为例)
```
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
```
```
sudo sed -i 's+download.docker.com+mirrors.cloud.tencent.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
```
```
sudo yum makecache fast
```
```
sudo yum install -y docker-ce
```
##### 2.2 docker-compose安装
```
curl -L https://get.daocloud.io/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
```
```
chmod +x /usr/local/bin/docker-compose
```
##### 2.3 docker 国内镜像配置
```
mkdir -p /etc/docker
```
```
vi /etc/docker/daemon.json
```
添加以下内容:
```
{
"registry-mirrors": [" https://docker.mirrors.ustc.edu.cn"]
}
failed to start daemon: invalid mirror: " https://docker.mirrors.ustc.edu.cn" is not a valid URI
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
```
##### 2.4 检查 docker 是否安装成功
```
docker -v
```
##### 2.5 检查 docker-compose 是否安装成功
```
docker-compose -v
```
##### 2.6 检查 docker 是否已启动
```
1.systemctl daemon-reload
```
```
2.systemctl restart docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
cd /etc/docker
vim daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
3、然后重启docker:systemctl restart docker
```
```
systemctl status docker
```