当前位置: 代码网 > it编程>开发工具>Docker > 安装docker时报错:Package ‘docker-ce‘ has no installation candidate

安装docker时报错:Package ‘docker-ce‘ has no installation candidate

2024年07月31日 Docker 我要评论
如果依旧报错,说明apt的源设置的不对。首先尝试更新,并重新安装。

安装docker,报错:

$ sudo apt-get install docker-ce docker-ce-cli containerd.io
reading package lists... done
building dependency tree... done
reading state information... done
package docker-ce is not available, but is referred to by another package.
this may mean that the package is missing, has been obsoleted, or
is only available from another source

e: package 'docker-ce' has no installation candidate
e: unable to locate package docker-ce-cli
e: unable to locate package containerd.io

首先尝试更新,并重新安装

sudo apt-get update && apt-get upgrade
sudo apt-get install docker-ce docker-ce-cli containerd.io

如果依旧报错,说明apt的源设置的不对。

安装阿里云证书,并配置阿里云的docker源:

curl -fssl https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - #安装阿里云gpg证书
cd /etc/apt/sources.list.d        #在指定目录下新建docker.list文件,添加阿里云镜像源
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

更新软件源,重新安装docker,等待安装完成:

sudo apt-get update       #更新软件源
sudo apt-get install docker-ce docker-ce-cli containerd.io    #重新安装docker

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com