#!/bin/bash
yum -y install gcc
yum -y install gcc-c++
yum install -y yum-utils
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
# 安装Docker
yum -y install docker-ce docker-ce-cli containerd.io
# 启动Docker服务
sudo systemctl start docker.service
# 设置Docker自启动
sudo systemctl enable docker.service
# 配置Docker加速器(可选)
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://z3zetxph.mirror.aliyuncs.com"]
#https://z3zetxph.mirror.aliyuncs.com 为阿里云镜像加速器,可以用我的也可以换成自己的
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker