当前位置:
首页 >
行业知识 >
Ubuntu之apt-get--解决安装docker的报错:Package docker-ce is not available, but is referred to by another p
行业知识
Ubuntu之apt-get--解决安装docker的报错:Package docker-ce is not available, but is referred to by another p
2026-11-25 03:26:17
来源:互联网转载
原���网址:Ubuntu之apt-get--解决安装docker的报错:Package docker-ce is not available, but is referred to by another p_IT利刃出鞘的博客-CSDN博客
()简介
本文介绍用Ubuntu的apt-get命令安装docker时提示docker-ce不可用的解决方法。
错误日志
Package docker-ce is not available, but is referred to by another package
()原因
此版本的源中没有docker-ce的安装包,所以报错。解决办法:使用旧版本的docker仓库(本处用的是bionic)。
法1:命令添加更新源
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
然后执行:
sudo apt-get update
备注:
移除某个源的方法是:
sudo add-apt-repository -r "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
法2:配置文件添加更新源
/etc/apt/sources.list.d/docker.list 中添加下面内容(此文件若不存在则新建)
deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable
命令如下:
cd /etc/apt/sources.list.d;sudo touch docker.list;sudo chmod 666 docker.list;sudo echo "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" > docker.list;
然后执行:
sudo apt-get update
下一篇:怎么防服务器攻击好友账号?