modify: 清除diskcache依赖
This commit is contained in:
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
# Docker 安装 + 国内公网镜像加速配置脚本 (Ubuntu 24.04 / amd64)
|
||||
# 注: mirrors.tencentyun.com / mirror.ccs.tencentyun.com 仅腾讯云 VPC 内网可用,
|
||||
# 本机不在腾讯云内网,故 apt 源使用腾讯云公网镜像站,registry 加速使用公网加速源。
|
||||
set -e
|
||||
|
||||
echo "==> [1/5] 安装基础依赖"
|
||||
apt-get update -y
|
||||
apt-get install -y ca-certificates curl gnupg
|
||||
|
||||
echo "==> [2/5] 添加 Docker 官方 GPG key 和仓库(腾讯云公网镜像)"
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
rm -f /etc/apt/keyrings/docker.gpg
|
||||
curl -fsSL https://mirrors.cloud.tencent.com/docker-ce/linux/ubuntu/gpg \
|
||||
| gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
|
||||
https://mirrors.cloud.tencent.com/docker-ce/linux/ubuntu \
|
||||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
|
||||
> /etc/apt/sources.list.d/docker.list
|
||||
|
||||
echo "==> [3/5] 安装 Docker 引擎"
|
||||
apt-get update -y
|
||||
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
|
||||
echo "==> [4/5] 配置镜像加速(公网加速源,多源容灾)"
|
||||
mkdir -p /etc/docker
|
||||
cat > /etc/docker/daemon.json <<'EOF'
|
||||
{
|
||||
"registry-mirrors": [
|
||||
"https://docker.m.daocloud.io",
|
||||
"https://docker.1ms.run",
|
||||
"https://hub.rat.dev"
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "==> [5/5] 启动并配置开机自启"
|
||||
systemctl enable docker
|
||||
systemctl restart docker
|
||||
|
||||
echo "==> 完成,验证:"
|
||||
docker --version
|
||||
docker run --rm hello-world
|
||||
docker info | grep -A5 "Registry Mirrors"
|
||||
Reference in New Issue
Block a user