Pop!_OS 22.04安装Docker时出现apt源404错误求助
问题描述
我的系统信息(lsb_release -a输出):
Distributor ID: Pop Description: Pop!_OS 22.04 LTS Release: 22.04 Codename: jammy
我误按照Debian的Docker安装教程操作,执行sudo apt-get update时出现以下错误:
>sudo apt-get update Ign:1 https://download.docker.com/linux/debian jammy InRelease Hit:2 http://apt.pop-os.org/proprietary jammy InRelease Hit:3 http://apt.pop-os.org/release jammy InRelease Err:4 https://download.docker.com/linux/debian jammy Release 404 Not Found [IP: 18.67.240.19 443] Hit:5 http://apt.pop-os.org/ubuntu jammy InRelease Hit:6 http://apt.pop-os.org/ubuntu jammy-security InRelease Hit:7 http://apt.pop-os.org/ubuntu jammy-updates InRelease Hit:8 http://apt.pop-os.org/ubuntu jammy-backports InRelease Reading package lists... Done E: The repository 'https://download.docker.com/linux/debian jammy Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.
我的/etc/apt/sources.list文件内容如下(仅注释,无有效源):
## See sources.list(5) for more information, especialy # Remember that you can only use http, ftp or file URIs # CDROMs are managed through the apt-cdrom tool. # deb cdrom:[Pop_OS 22.04 _Jammy Jellyfish_ - Release amd64 (20221026)]/ jammy main restricted # deb cdrom:[Pop_OS 22.04 _Jammy Jellyfish_ - Release amd64 (20221026)]/ stable main restricted # deb cdrom:[Pop_OS 22.04 _Jammy Jellyfish_ - Release amd64 (20221026)]/ unstable main restricted
我曾尝试添加[trusted=yes] https://download.docker.com/linux/debian,但问题依旧。
解决方案
核心问题
你用了Debian的Docker源,但Pop!_OS 22.04基于Ubuntu Jammy,Debian源里没有jammy版本的Release文件,所以报404错误。
修复步骤
删除错误的Debian Docker源
先找到添加的错误源文件,通常存放在/etc/apt/sources.list.d/目录下,文件名类似docker.list:sudo rm /etc/apt/sources.list.d/docker.list不确定文件名的话,可先列出目录内容确认:
ls /etc/apt/sources.list.d/添加正确的Ubuntu Docker源
执行以下命令添加适配Ubuntu Jammy的Docker官方源:# 导入Docker官方GPG密钥 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker.gpg # 添加适配jammy的源 echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu jammy stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null更新软件包列表并安装Docker
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin验证安装结果
运行hello-world容器测试Docker是否正常工作:sudo docker run hello-world
内容的提问来源于stack exchange,提问作者Serdar
相关产品推荐
相关产品推荐

