#!/bin/bash
# Centos新版本Docker安装:https://www.cnblogs.com/Peter2014/p/7704306.html
# step 1: 安装必要的一些系统工具
yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新并安装 Docker-CE
yum makecache fast
yum install docker-ce-18.06.0.ce -y
# Step 4: 开启Docker服务
systemctl restart docker

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://vcugatat.mirror.aliyuncs.com"],
  "hosts": [
    "tcp://0.0.0.0:0306",
    "unix:///var/run/docker.sock"
  ]
}
EOF
systemctl daemon-reload
systemctl restart docker
systemctl enable docker