原因
为了简化安装docker和docker-compose,所以写了脚本,自动安装
具体脚本内容
#!/bin/bash
# install docker shell
# 1. 使用脚本自动安装
echo "1.使用脚本自动安装..."
curl -sSL https://get.daocloud.io/docker | sh
# 2.启动 Docker CE
echo "2.启动 Docker CE..."
sudo systemctl enable docker
sudo systemctl start docker
# 3.测试 Docker 是否安装正确
echo "3.测试 Docker 是否安装正确..."
docker run hello-world
# 4.添加镜像加速器
echo "4.添加镜像加速器..."
rm -rf /etc/docker/daemon.json
cp ./daemon.json /etc/docker
# 5.重新启动服务
echo "5.重新启动服务..."
sudo systemctl daemon-reload
sudo systemctl restart docker
# 6.检测
echo "6.检测..."
docker info
# 7.安装docker-compose
echo "7.安装docker-compose"
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod a+x /usr/local/bin/docker-compose
# 8.验证是否安装成功
echo "8.验证是否安装成功..."
docker-compose -v
附上资源链接地址
daemon.json
{
“registry-mirrors”: [
“https://5ajk0rns.mirror.aliyuncs.com”
]
}