安装docker报错:E: Unable to locate package docker-model-plugin(ubuntu版本过旧)

发布于:2025-09-04 ⋅ 阅读:(15) ⋅ 点赞:(0)

在这里插入图片描述

root@ubuntu:~# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# Executing docker install script, commit: bedc5d6b3e782a5e50d3d2a870f5e1f1b5a38d5c
Warning: the "docker" command appears to already exist on this system.

If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.

If you installed the current Docker package using this script and are using it
again to update Docker, you can ignore this message, but be aware that the
script resets any custom changes in the deb and rpm repo configuration
files to match the parameters passed to the script.

You may press Ctrl+C now to abort this script.
+ sleep 20

DEPRECATION WARNING
    This Linux distribution (ubuntu focal) reached end-of-life and is no longer supported by this script.
    No updates or security fixes will be released for this distribution, and users are recommended
    to upgrade to a currently maintained version of ubuntu.

Press Ctrl+C now to abort this script, or wait for the installation to continue.
+ sh -c 'apt-get -qq update >/dev/null'
+ sh -c 'DEBIAN_FRONTEND=noninteractive apt-get -y -qq install ca-certificates curl >/dev/null'
+ sh -c 'install -m 0755 -d /etc/apt/keyrings'
+ sh -c 'curl -fsSL "https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg" -o /etc/apt/keyrings/docker.asc'
+ sh -c 'chmod a+r /etc/apt/keyrings/docker.asc'
+ sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal stable" > /etc/apt/sources.list.d/docker.list'
+ sh -c 'apt-get -qq update >/dev/null'
+ sh -c 'DEBIAN_FRONTEND=noninteractive apt-get -y -qq install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin docker-model-plugin >/dev/null'
E: Unable to locate package docker-model-plugin


根据您的安装日志和上下文信息,问题根源在于 Ubuntu 20.04 (Focal) 已经过期(EOL),而阿里云镜像源中未提供 docker-model-plugin 包。以下是解决方案:


1. 升级 Ubuntu 系统(推荐)

由于 Ubuntu 20.04 已停止支持,强烈建议升级到受支持的版本(如 22.04 Jammy 或 24.04 Noble)。以下是升级步骤:

升级到 Ubuntu 22.04

# 修改 sources.list 文件
sudo sed -i 's/focal/jammy/g' /etc/apt/sources.list
sudo sed -i 's/focal/jammy/g' /etc/apt/sources.list.d/*

# 更新系统并升级
sudo apt update && sudo apt full-upgrade -y
sudo do-release-upgrade

安装 Docker

升级后,重复安装命令:

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

2. 临时解决方案(不推荐长期使用)

如果无法立即升级系统,可手动修改安装包列表,跳过 docker-model-plugin

步骤 1:修改安装脚本

编辑安装脚本,移除 docker-model-plugin

# 下载安装脚本
curl -fsSL https://get.docker.com -o install-docker.sh

# 编辑脚本,删除 docker-model-plugin
sed -i '/docker-model-plugin/d' install-docker.sh

# 执行安装
bash install-docker.sh --mirror Aliyun

步骤 2:手动安装缺失的依赖(可选)

如果需要 docker-model-plugin,可尝试从其他源获取(需确保兼容性):

# 查找可用版本(以 Jammy 为例)
apt-cache madison docker-model-plugin

# 安装特定版本(需替换为实际版本号)
sudo apt install docker-model-plugin=<version>

3. 使用特定 Docker 版本

指定安装一个不包含 docker-model-plugin 的旧版本(如 24.0):

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun --version 24.0

4. 验证安装

安装完成后,检查 Docker 是否正常运行:

sudo systemctl status docker
docker --version
docker info | grep "Server Version"

注意事项

  • 长期使用需升级系统:Ubuntu 20.04 已无安全更新,继续使用可能导致风险。
  • 镜像源兼容性:阿里云镜像源可能未同步最新包,建议定期检查 阿里云镜像站

通过以上步骤,您应能成功安装 Docker 并规避 docker-model-plugin 的缺失问题。


网站公告

今日签到

点亮在社区的每一天
去签到