2024.6.27可用 ubuntu 使用华为镜像源安装docker
# 使用华为源
# 安装依赖
sudo apt-get install curl
sudo apt-get install -y gnupg2 gnupg1 gnupg
# 信任Docker GPG公钥
curl -fsSL https://repo.huaweicloud.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# 如果发生add-apt-repository命令未找到时,安装software-properties-common
sudo apt-get install software-properties-common
# 添加软件仓库
sudo add-apt-repository "deb [arch=amd64] https://repo.huaweicloud.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# 更新索引
sudo apt-get update
# 安装docker-ce 执行此命令会下载最新的Docker版本。
sudo apt-get install docker-ce
# 查看所有版本
sudo apt-cache madison docker-ce
# 下载指定版本
sudo apt-get install -y docker-ce=5:20.10.13~3-0~ubuntu-jammy
#启动docker
sudo systemctl start docker
# 使Docker开机自启
sudo systemctl enable docker
需要注意的点是如果之前使用过其他源下载失败后需要把其他源的 文件删除 一般是在:/etc/apt/sources.list.d
我之前在这个目录删除了阿里云的:
rm archive_uri-http_mirrors_aliyun_com_docker-ce_linux_ubuntu-noble.list
安装成功:


浙公网安备 33010602011771号