我在虚拟机上安装docker时遇到问题。我遵循了以下步骤:
1。Docker的旧版本被称为Docker, Docker。Io,即docker-engine。如果安装了这些,请卸载:
sudo apt-get remove docker docker-engine docker.io containerd runc
2。更新apt包索引
sudo apt-get update
3。安装包以允许apt通过HTTPS使用存储库:
sudo apt-get install
apt-transport-https
ca-certificates
curl
gnupg
lsb-release
4。添加Docker的官方GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
5。使用以下命令设置稳定库:
echo
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]
https://download.docker.com/linux/ubuntu
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >
/dev/null
6。更新apt包索引
sudo apt-get update
此时—在输入sudo apt-get update之后—我得到以下错误
root@xxx:/home/xxx# sudo apt-get update
Hit:1 http://us-central1.gce.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://us-central1.gce.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://us-central1.gce.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Ign:5 https://download.docker.com/linux/ubuntu InRelease
Err:6 https://download.docker.com/linux/ubuntu Release
404 Not Found [IP: 13.249.137.69 443]
Reading package lists... Done
E: The repository 'https://download.docker.com/linux/ubuntu 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.d/docker.list
内容
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] download.docker.com/linux/ubuntu focal stable
有办法修复它吗?
确保/etc/apt/sources.list.d/docker.list
的内容与文档中项目#3命令的输出相对应。
在我写这篇文章的时候,在我的Ubuntu 20.04 LTS上执行这个命令会导致docker的以下内容。列表文件:deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu focal stable
似乎和你的不一样。
我也有同样的问题,
我的码头工人。列表文件
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable
/ubuntu
和jammy stable
之间有太多空格…一旦去掉额外的空间,sudo apt-get update
就可以工作了。