Col*_*ado 21
嗨 mire12,欢迎来到 Ask Ubuntu。我希望您发现该站点有用并在未来几年继续使用 Ubuntu!
如果您查看Docker 的安装页面,您会看到为了配置您要安装的存储库docker,您将运行:
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Run Code Online (Sandbox Code Playgroud)
如果仔细观察,您会看到命令lsb_release -cs已运行。如果您尝试在您的机器上执行它,您将获得发行版的代号。对于 Ubuntu 20.10,groovy发行版的名称是Groovy Gorilla(如果你问我,这个发行版名称真的很酷:P)。我不是 100% 确定这是你会得到的,因为我还没有更新......不管怎样,我确定输出lsb_release -cs不是focal(20.04)、bionic(18.04) 或xenial(16.04)哪些是docker目前支持的。
然后,如果您运行 ,sudo add-apt-command您将添加以下存储库:deb [arch=amd64] https://download.docker.com/linux/ubuntu groovy stable
这不存在,因为docker仅支持我之前列出的三个版本。
然后你有两个选择。
第一个是等到他们发布docker20.10 版本。我不确定他们是否会这样做,如果他们这样做,我不知道需要多长时间。
您可以手动运行命令 swapping lsb_release -csforfocal以使用Focal Fossa的docker版本。这并不能保证兼容性,但我已经做过几次,效果很好。如果你试图沿着这条路走,你将不得不跑:
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
focal \
stable"
Run Code Online (Sandbox Code Playgroud)
我希望这对你有用!如果没有,您也可以尝试手动下载.deb文件docker并使用dpkg. 您可以在我开头链接的页面上阅读更多内容(即这个:P)
PD:
命令中$()使用的结构在 Bash 的行话中add-apt-repository称为命令替换。它基本上做的是用$()括号内的任何内容的输出替换整个结构。在我们的例子中,这相当于替换$(lsb_release -cs)为groovy。这就是为什么手动修复发布代号是一种可行的解决方法。
您可以在 Bash 的联机帮助页上阅读有关命令替换的更多信息,如果安装了 Bash ,您可以通过运行来阅读。它是 Ubuntu 上的默认 shell,因此很可能是您常用的一种。手册页值得一读;我通过这样做学到了很多:P。我在命令替换上引用了一点,从联机帮助页解释了上述内容,这样您就不必梳理它:man bash
Command Substitution
Command substitution allows the output of a command to replace
the command name. There are two forms:
$(command)
or
`command`
Bash performs the expansion by executing command and replacing
the command substitution with the standard output of the command,
with any trailing newlines deleted.
Embedded newlines are not deleted, but they may be removed during
word splitting. The command substitution $(cat file) can be
replaced by the equivalent but faster $(< file).
Run Code Online (Sandbox Code Playgroud)
您也可以在此处在线阅读,但我发现在终端模拟器上阅读联机帮助页更具吸引力。我喜欢它的老派氛围:P
| 归档时间: |
|
| 查看次数: |
14561 次 |
| 最近记录: |