2023-07-19
学习资料
00

最近在用某IDC的系统提供的DEBIAN11模板中,发现安装docker无法成功。 经排查是内置的debian11源的问题。

  1. 编辑debian内置的debian源,位置/etc/apt/sources.list

  2. 将里面的文本替换为下面的源

/etc/apt/sources.list
deb https://mirrors.huaweicloud.com/debian/ bullseye main non-free contrib deb https://mirrors.huaweicloud.com/debian/ bullseye-updates main non-free contrib deb https://mirrors.huaweicloud.com/debian/ bullseye-backports main non-free contrib deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main non-free contrib deb https://security.debian.org/debian-security bullseye-security main non-free contrib deb-src https://mirrors.huaweicloud.com/debian/ bullseye main non-free contrib deb-src https://mirrors.huaweicloud.com/debian/ bullseye-updates main contrib deb-src https://mirrors.huaweicloud.com/debian/ bullseye-backports main non-free contrib deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main non-free contrib deb-src https://security.debian.org/debian-security bullseye-security main non-free contrib
  1. 保存并更新源
apt update
  1. 安装必要的软件
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release
  1. 添加Docker GPG密钥
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  1. 将Docker软件包源添加到系统的APT源列表中:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  1. 使用官方脚本安装docker
curl -fsSL https://get.docker.com | bash -s docker