18.04 中的“包 'docker-ce' 没有候选安装”

Rob*_*low 99 apt docker 18.04

我正在遵循Ubuntu 上 docker-ce的官方 Docker 安装指南

当我到达时,sudo apt install docker-ce我得到E: Package 'docker-ce' has no installation candidate

$ sudo apt-get update
Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done

$ sudo apt-get install \
>     apt-transport-https \
>     ca-certificates \
>     curl \
>     software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ca-certificates is already the newest version (20180409).
curl is already the newest version (7.58.0-2ubuntu3).
software-properties-common is already the newest version (0.96.24.32.1).
The following NEW packages will be installed
  apt-transport-https
0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
Need to get 1,692 B of archives.
After this operation, 152 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://gb.archive.ubuntu.com/ubuntu bionic/universe amd64 apt-transport-https all 1.6.1 [1,692 B]
Fetched 1,692 B in 0s (65.4 kB/s)               
Selecting previously unselected package apt-transport-https.
(Reading database ... 116694 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.6.1_all.deb ...
Unpacking apt-transport-https (1.6.1) ...
Setting up apt-transport-https (1.6.1) ...

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK

$ sudo apt-key fingerprint 0EBFCD88
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
sub   rsa4096 2017-02-22 [S]

$ sudo add-apt-repository \
>    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
>    $(lsb_release -cs) \
>    stable"
Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                                    
Hit:3 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                                  
Get:4 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]                                                       
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                               
Fetched 64.4 kB in 0s (141 kB/s)
Reading package lists... Done

robin@xps:~/git/snapcraft.io$ sudo apt-get update
Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease                                      
Hit:3 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                                   
Hit:4 https://download.docker.com/linux/ubuntu bionic InRelease                                                                                        
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                                
Reading package lists... Done  

$ sudo apt-get install docker-ce
Reading package lists... Done
Building dependency tree       
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
Run Code Online (Sandbox Code Playgroud)

我的第一个想法是 Docker 还没有发布 Bionic 包(它很新)但是当我搜索“安装 docker-ce ubuntu 18.04”时,我发现了一个指南,它似乎是 18.04 特定的,基本上只是给出了完全相同的说明- 建议它至少对作者有用:

https://linuxconfig.org/how-to-install-docker-on-ubuntu-18-04-bionic-beaver

有谁知道为什么这可能对我不起作用?

小智 85

如果要安装运行此docker-ce有关Ubuntu 18.04

sudo apt install apt-transport-https ca-certificates curl software-properties-common
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` test"
sudo apt update
sudo apt install docker-ce
Run Code Online (Sandbox Code Playgroud)

要检查安装是否成功结束,只需运行:

docker -v
Run Code Online (Sandbox Code Playgroud)

应该输出:

Docker version 18.06.1-ce, build e68fc7a
Run Code Online (Sandbox Code Playgroud)

  • 此外,在“Ubuntu 19”的情况下,只需将第三行中的“bionic”更改为“disco” (9认同)
  • 伙计们,从版本开始,它看起来像后缀`-ce` 和`-ee` [已删除](https://github.com/docker/docker-ce-packaging/pull/206)。`18.09.0`,所以据我所知没有错误。从 `test` 构建检查我的安装 - `sudo docker run hello-world` 工作正常。我看到的唯一问题 - 19 版是测试版。抱歉让您感到困惑 - 仅使用 Linux 的第 2 周 :) (2认同)

小智 44

根据您引用的同一指南,此时您可以改用 17.10 的存储库:

deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable
Run Code Online (Sandbox Code Playgroud)

并且所有docker-ce依赖包都将从 ubuntubionic存储库解析。查看Docker 文档以获取更多信息。无需担心兼容性问题:)

2018-07-19 更新

Docker 18.06 已更新到bionic存储库,不再需要此解决方法!

  • 在 18.04 上仍然不起作用。我仍然得到`E:包'docker-ce'没有安装候选` (16认同)
  • 仅供参考,自 6 月 21 日起,它可以通过以下方式安装:``curl -fsSL get.docker.com | 频道=稳定的sh`` (2认同)

小智 10

一些导游跳了枪;在撰写本文时,docker-ce 尚不可用于 Ubuntu 18.04。您可以在此处查看支持的版本列表。

您链接到建议安装 docker.io 的同一指南;这就是我所做的。这是一种解决方法,直到 docker-ce 支持 18.04。

  • 我正在运行 18.04,将 URL 指向 artful 对我没有帮助。唯一有效的是安装 docker.io。 (2认同)

小智 8

按照Docker 文档中的步骤操作对我有用。我只stable需要test在此命令中更改为

sudo add-apt-repository \ 
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Run Code Online (Sandbox Code Playgroud)


小智 7

我遇到了同样的问题,这是我修复它的方法:

$ sudo snap install docker

$docker -v

Docker version 18.06.1-ce, build e68fc7a


$sudo docker version


Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.4
 Git commit:        e68fc7a
 Built:             Tue May  7 18:01:43 2019
 OS/Arch:           linux/386
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       e68fc7a
  Built:            Tue May  7 18:01:44 2019
  OS/Arch:          linux/386
Run Code Online (Sandbox Code Playgroud)

  • 但请注意,它安装的是 docker 18 而不是 19。它几乎没有用。 (2认同)