Docker 安装(新机器才需要,走阿里云源)
apt-get update && apt-get install -y ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo "deb arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc https://mirrors.aliyun.com/docker-ce/linux/ubuntu (. /etc/os-release \&\& echo VERSION_CODENAME) stable" > /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
镜像源配置(核心,已生效)
- 写 /etc/docker/daemon.json:
bash
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://docker.1panel.live"
]
}
- 重启生效:
systemctl restart docker
- 验证:
docker info | grep -A5 "Registry Mirrors"
docker pull postgres:16-alpine # 能拉下来就 OK