我正在尝试在 Ubuntu 64 机器上安装 Docker,如下所示官方安装指南。
遗憾的是 Ubuntu 似乎无法找到该docker-ce
包。有什么想法可以修复它或至少跟踪正在发生的事情吗?
这里为您提供一些详细信息...
$ uname --all; sudo grep docker /etc/apt/sources.list; sudo apt-get install docker-ce
Linux ubuntu 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable.
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable.
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package docker-ce
答案1
添加Docker官方GPG密钥:
sudo apt update
sudo apt install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
Ubuntu 23.10(曼蒂克牛头怪)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu mantic stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 23.04(月球龙虾)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu lunar stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 22.10(动力学)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu kinetic stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 22.04(杰米)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 21.10(顽皮)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu impish stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 21.04(多毛)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu hirsute stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 20.10(Groovy)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu groovy stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 20.04(焦点)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu focal stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 19.10(Eoan)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu eoan stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 19.04(迪斯科)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu disco stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 18.10(宇宙)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu cosmic stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 18.04(仿生)
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu bionic stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
乌班图17.10
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu artful stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
乌班图16.04
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu xenial stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
运行以下命令:
sudo apt update
apt-cache search docker-ce
示例输出:
docker-ce - Docker: the open-source application container engine
安装docker-ce
:
sudo apt install docker-ce
要检查可用且允许的 Ubuntu 代号:
curl -sSL https://download.docker.com/linux/ubuntu/dists/ |awk -F'"' 'FNR >7 {print $2}'
示例输出(目录更新后结果可能会有所不同):
../
artful/
bionic/
cosmic/
disco/
eoan/
focal/
groovy/
hirsute/
impish/
jammy/
kinetic/
lunar/
trusty/
xenial/
yakkety/
zesty/
码头工人,操作系统要求
答案2
对于使用 Ubuntu 17.10(巧妙)并遇到此问题的任何人:
从https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
要安装 Docker CE,您需要以下 Ubuntu 版本之一的 64 位版本:
巧妙的 17.10(Docker CE 17.11边缘仅有的)
热情 17.04
仙尼尔 16.04
(LTS) 可信赖 14.04 (LTS)
和:
要添加边缘或测试存储库,请添加单词边缘或测试(或两者)在命令中的稳定一词之后
所以如果你使用的是 Ubuntu 17.10 (artful),你需要添加以下内容:
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable edge"
注意到添加了“边缘”一词。如果您之前已经在没有“edge”的情况下运行过此命令。您可以source.list
在 处编辑该文件/etc/apt/sources.list
。之后,docker-ce
像往常一样刷新并安装:
sudo apt-get update
sudo apt-get install docker-ce
答案3
尝试使用:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get update
$ sudo apt install docker.io
答案4
以上都不适合我。
我完全删除了 docker,然后手动删除了/var
.
之后重新安装并运行完美。