Docker Repository 在 Ubuntu 上没有运行 apt-get 更新的发布文件

我正在使用 Ubuntu 16.10,最近安装了 Docker (v1.12.4) ,使用 Xenial 构建,遵循了 给你的说明。我在创建容器、确保它们自动重新启动等方面没有遇到任何问题。

但是,现在每次运行 Apt-get 更新都会收到以下错误消息:

W: The repository 'https://apt.dockerproject.org/repo ubuntu-xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/Packages
E: Some index files failed to download. They have been ignored, or old ones used instead.

我试图纠正这个问题,按照建议发现 给你和似乎不能解决这个问题。

以前有人遇到过这种情况并修复它吗? 如果有,需要什么来解决这个问题?

195356 次浏览

我在这里看到一篇来自 Ikraider 的有趣帖子,它解决了我的问题: Https://github.com/docker/docker/issues/22599

网站说明是错误的,以下是16.04版本中的工作原理:

curl -s https://yum.dockerproject.org/gpg | sudo apt-key add
apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D
sudo add-apt-repository "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main"
sudo apt-get update
sudo apt-get install docker-engine=1.13.0-0~ubuntu-xenial

在 LinuxMint 上,官方的说明对我不起作用。我不得不进入 /etc/apt/sources.list.d/additional-repositories.list并将 serena改为 xenial以反映我的 Ubuntu 代号。根据您的 Debian 变体、版本和所遵循的原始安装方法,您可能需要修改 /etc/apt/sources.list.d/docker.list

通常可以通过运行几个不同的命令之一来找到适当的代码名。在以下示例中,focal是代号:

$ grep CODENAME /etc/os-release
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal


$ lsb_release -c
Codename:   focal


# NOTE: On Ubuntu 20.04.2, /etc/os-release is symlinked to /usr/lib/os-release and
#       lsb_release reads from /usr/lib/os-release.

对于 Linux Mint,这个问题实际上在 码头网站中引用了:

注意: 下面的 lsb_release -cs子命令返回您的 Ubuntu 发行版,例如 xenial LinuxMint,您可能必须将 $(lsb_release -cs)更改为您的父级 例如,如果你正在使用 Linux Mint Rafaela, 你可以用信任。

Amd64:

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

lsb_release -cs命令提供了一个 Docker 没有准备好的软件包的存储库-您必须将其更改为 Xenial。

基于 Ubuntu 16.04 Xenial 的 Linux Mint 18的正确命令是

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
xenial \
stable"

埃利奥特海滩是正确的。谢谢埃利奥特。

这是我的 大意代码。

sudo apt-get remove docker docker-engine docker.io


sudo apt-get update


sudo apt-get install apt-transport-https ca-certificates curl software-properties-common


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


sudo apt-key fingerprint 0EBFCD88


sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
xenial \
stable"


sudo apt-get update


sudo apt-get install docker-ce


sudo docker run hello-world

我仍然有同样的问题。上面的答案似乎都没有解决它。 我使用的是 ubuntu 16.04,并且遵循了 https://docs.docker.com/install/linux/docker-ce/ubuntu/中描述的步骤

我怀疑它与一个关于 https 的 apt-get错误有关。apt-get打印的信息有点误导人。

我认为 Failed to fetch..也可以翻译成: problem accessing resource from within an https connection

我是怎么得出这个结论的:

首先,我是一个企业代理,所以我设置了以下内容 配置:

/etc/apt/apt.conf

Acquire::http::proxy "http://squidproxy:8080/";
Acquire::https::proxy "http://squidproxy:8080/";
Acquire::ftp::proxy "ftp://squidproxy:8080/";


Acquire::https::CaInfo     "/etc/ssl/certs/ca-certificates.pem";

/etc/apt/apt.con.d/99代理

Acquire::http::Proxy {
localhost DIRECT;
localhost:9020 DIRECT;
localhost:9021 DIRECT;
};

我使用 sources.list中的不同条目执行了以下测试

试题一:

deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable

sudo apt-get update

W: The repository 'https://download.docker.com/linux/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration     details.
E: Failed to fetch     https://download.docker.com/linux/ubuntu/dists/xenial/stable/binary-amd64/Packages
E: Some index files failed to download. They have been ignored, or old ones used instead.

失败

试题二:

deb [arch=amd64] http://localhost:9020/linux/ubuntu xenial stable

/etc/apache2/sites- 启用/apt-proxy. conf

# http to https reverse proxy configuration.
Listen 9020
<VirtualHost *:9020>
SSLProxyEngine On
# pass from squid proxy
ProxyRemote https://download.docker.com/ http://squidproxy:8080
ProxyPass / https://download.docker.com/
ProxyPassReverse / https://download.docker.com/
ErrorLog ${APACHE_LOG_DIR}/apt-proxy-error.log
CustomLog ${APACHE_LOG_DIR}/apt-proxy-access.log combined
</VirtualHost>

sudo apt-get update

Hit:1 ..
Hit:2 ..
...
Hit:7 http://localhost:9020/linux/ubuntu xenial InRelease
Get:8 ...
Fetched 323 kB in 0s (419 kB/s)
Reading package lists... Done

成功

试题三:

deb [arch=amd64] https://localhost:9021/linux/ubuntu xenial stable

/etc/apache2/sites- 启用/apt-proxy. conf

# https to https revere proxy
Listen 9021
<VirtualHost *:9021>
# serve on https
SSLEngine on
SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
SSLProxyEngine On
# pass from squid proxy
ProxyRemote https://download.docker.com/ http://squidproxy:8080
ProxyPass / https://download.docker.com/
ProxyPassReverse / https://download.docker.com/
ErrorLog ${APACHE_LOG_DIR}/apt-proxy-error.log
CustomLog ${APACHE_LOG_DIR}/apt-proxy-access.log combined
</VirtualHost>

sudo apt-get update

W: The repository 'https://localhost:9021/linux/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch https://localhost:9021/linux/ubuntu/dists/xenial/stable/binary-amd64/Packages
E: Some index files failed to download. They have been ignored, or old ones used instead.

失败


在上述情况下,apt-get Failed to fetchRelease文件的 URL 实际上可以通过相同的代理配置从 browser/wget/curl访问。
事实上,apt-get工作只与 http 反向代理网址,意味着有一些 从 https 连接中访问资源的问题
我不知道这个问题是什么,但 apt-get应该显示一个更具信息性的消息(apt甚至更少冗长)。

注意: 线路共享案例1表明代理 CONNECT是成功的,没有发送 RST,但是当然无法读取文件。

我也有过类似的问题,有人可能会发现对我有用的东西。

机器正在运行 Ubuntu 16.04并且有 Docker CE。在浏览了这里提供的答案和链接之后,特别是从 Elliot Beach 提供的 Docker 网站的链接,我打开了我的/etc/apt/sources.list 并检查了它。

该文件同时具有 deb [arch=amd64] https://download.docker.com/linux/ubuntu (lsb_release -cs) stabledeb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable

因为需要第二个,所以我只需注释掉第一个,保存文档,现在问题就解决了。作为测试,我返回到同一个文档,删除注释符号并再次运行 sudo apt-get update。当我这样做时,问题又回来了。

因此,简要回顾一下: 我不仅有我的父母 Ubuntu 发行版的名称在 Docker 网站上说明,但我也注释了行仍然包含(lsb _ release-cs)。

最好检查一下这个问题: (如果你使用代理服务器) ,(在 ubuntu 18.04上测试) ,(也可以在其他 ubuntu 上使用) ,(大部分错误出现在: https _ xy = “ http://192.168.0.251:808/”)

  1. 检查这些文件:

    #sudo cat /etc/environment :
    http_proxy="http://192.168.0.251:808/"
    https_proxy="http://192.168.0.251:808/"
    ftp_proxy="ftp://192.168.0.251:808/"
    socks_proxy="socks://192.168.0.251:808/"
    #sudo cat /etc/apt/apt.conf :
    Acquire::http::proxy "http://192.168.0.251:808/";
    Acquire::https::proxy "http://192.168.0.251:808/";
    Acquire::ftp::proxy "ftp://192.168.0.251:808/";
    Acquire::socks::proxy "socks://192.168.0.251:808/";
    
  2. Add docker stable repo

    #sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    
  3. Run apt-get update:

    #sudo apt-get update
    
  4. Check Docker CE

    #apt-cache policy docker-ce
    
  5. install Docker

    #sudo apt-get install docker-ce
    

正如官方 Docker 文档中所建议的那样,试着运行以下命令:

  • sudo vi /etc/apt/sources.list

然后在文件的最后几行删除/注释任何(deb [arch=amd64] https://download.docker.com/linux/ubuntu/ xenial stable)这样的条目。

然后在终端运行这个命令:

  • sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu/ bionic stable"

  • sudo apt-get update

我的案子就是这样。

编辑文件 /etc/apt/sources.list.d/additional-repositories.list并添加 deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable 为我工作,这个职位是非常有帮助的 https://github.com/typora/typora-issues/issues/2065

这就是我在 LinuxMint 19上的成功之处。

curl -s https://yum.dockerproject.org/gpg | sudo apt-key add
apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D
sudo add-apt-repository "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io


我在 Linux 薄荷上也遇到过类似的问题我所做的就是发现 Debian 版本使用了,

$cat/etc/debian _ version Buster/sid

然后替换了 Debian 版本

$ sudo vi /etc/apt/sources.list.d/additional-repositories.list
deb [arch=amd64] https://download.docker.com/linux/debian    buster    stable

LinuxMint20 Ulyana 用户需要在

/etc/apt/sources.list.d/additional-repositories.list

像这样:

deb [arch=amd64] https://download.docker.com/linux/ubuntu    bionic    stable

在 Linux Mint 更改目录

cd /etc/apt/sources.list.d
ls -la

找到一个名为 Docker List的文件并使用 nano 文本编辑器进行编辑

sudo nano docker.list
// or
/etc/apt/sources.list.d/additional-repositories.list

替换版本的 Linux 薄荷在我的情况下,它是焦点 在你的情况下,它可能是仿生的,焦点,假人等

查看代号

lsb_release -a
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu focal stable

对于 Linux Mint 20.3 Cinnamon以下过程为我工作。

检查 Debian 版本:

$ cat /etc/debian_version
bullseye/sid

然后在 x 编辑器中打开文件

sudo xed /etc/apt/sources.list.d/docker.list

并将版本从 太空总署更新到 正中靶心

如果您正在使用 Parrot OS 或任何其他 Debian 基础 OS,则必须在 /etc/apt/sources.list.d/docker.list中编辑 docker.list,以使用您的 OS 的 Debian 版本(靶心、假人老兄等等)。

sudo nano /etc/apt/sources.list.d/docker.list

上面的命令将打开 docker.list 文件,您可以在其中将链接更改为如下所示:

deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bullseye stable

用你的操作系统 debian 代码代替靶心,然后保存,然后再次运行 sudo apt-get update

我用的是 Linux 薄荷20.3

命令返回 una。将命名重命名为 Xenial 效果不是很好,但仿生效果很好

deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu bionic stable

虽然这是一个较老的职位,我遇到了类似的问题就在昨天。 Docker 自己的网站 上的说明对我不起作用,而且我得到了一些安装错误: (在终端输出的一些有问题的行下面) :

Get:6 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Err:7 https://download.docker.com/linux/debian focal Release
404  Not Found [IP: 13.227.219.37 443]
Reading package lists... Done
E: The repository 'https://download.docker.com/linux/debian focal 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.
root@<my-server-name>:~# sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
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
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io'
E: Couldn't find any package by regex 'containerd.io'
E: Unable to locate package docker-compose-plugin
root@<my-server-name>:~# sudo apt-get upgrade

在搜索和尝试了几个修复后,我发现 # Prashant Abdare 提供的响应是最有用的。 在运行以下命令时:

$ cat /etc/debian_version

我得到了以下输出:

红心/Sid

由于没有安装 x 编辑器,我只是在服务器根目录中用 sudo nano 替换了 # Prashant Abdare 的命令:

$ sudo nano /etc/apt/sources.list.d/docker.list

接下来,我只是编辑条目(如他所指出的) ,将其中的 Debian 版本从 换句话说,来自(不正确的) :

deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian   focal stable

(为我的系统修正) :

deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian   bullseye stable

在此之后,我只是运行以下命令(来自 Docker 的原始指令 ) :

$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

这一次,安装非常成功,以前的问题(来自粘贴在上面的终端输出线)得到了修复,因此更新到了20.10.17版本:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
bridge-utils dns-root-data dnsmasq-base libidn11 ubuntu-fan
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
docker-ce-rootless-extras docker-scan-plugin slirp4netns
Suggested packages:
aufs-tools cgroupfs-mount | cgroup-lite
The following packages will be REMOVED:
containerd docker.io runc
The following NEW packages will be installed:
containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin docker-scan-plugin slirp4netns
0 upgraded, 7 newly installed, 3 to remove and 0 not upgraded.
Need to get 108 MB of archives.
After this operation, 115 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.digitalocean.com/ubuntu focal/universe amd64 slirp4netns amd64 0.4.3-1 [74.3 kB]
Get:2 https://download.docker.com/linux/debian bullseye/stable amd64 containerd.io amd64 1.6.7-1 [28.1 MB]
Get:3 https://download.docker.com/linux/debian bullseye/stable amd64 docker-ce-cli amd64 5:20.10.17~3-0~debian-bullseye [40.6 MB]
Get:4 https://download.docker.com/linux/debian bullseye/stable amd64 docker-ce amd64 5:20.10.17~3-0~debian-bullseye [21.0 MB]
Get:5 https://download.docker.com/linux/debian bullseye/stable amd64 docker-ce-rootless-extras amd64 5:20.10.17~3-0~debian-bullseye[8159 kB]
Get:6 https://download.docker.com/linux/debian bullseye/stable amd64 docker-compose-plugin amd64 2.6.0~debian-bullseye [6562 kB]
Get:7 https://download.docker.com/linux/debian bullseye/stable amd64 docker-scan-plugin amd64 0.17.0~debian-bullseye [3520 kB]
Fetched 108 MB in 2s (44.9 MB/s)
(Reading database ... 95602 files and directories currently installed.)
Removing docker.io (20.10.12-0ubuntu2~20.04.1) ...
'/usr/share/docker.io/contrib/nuke-graph-directory.sh' -> '/var/lib/docker/nuke-graph-directory.sh'
Removing containerd (1.5.9-0ubuntu1~20.04.4) ...
Removing runc (1.1.0-0ubuntu1~20.04.1) ...
Selecting previously unselected package containerd.io.
(Reading database ... 95340 files and directories currently installed.)
Preparing to unpack .../0-containerd.io_1.6.7-1_amd64.deb ...
Unpacking containerd.io (1.6.7-1) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../1-docker-ce-cli_5%3a20.10.17~3-0~debian-bullseye_amd64.deb ...
Unpacking docker-ce-cli (5:20.10.17~3-0~debian-bullseye) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../2-docker-ce_5%3a20.10.17~3-0~debian-bullseye_amd64.deb ...
Unpacking docker-ce (5:20.10.17~3-0~debian-bullseye) ...
Selecting previously unselected package docker-ce-rootless-extras.
Preparing to unpack .../3-docker-ce-rootless-extras_5%3a20.10.17~3-0~debian-bullseye_amd64.deb...
Unpacking docker-ce-rootless-extras (5:20.10.17~3-0~debian-bullseye) ...
Selecting previously unselected package docker-compose-plugin.
Preparing to unpack .../4-docker-compose-plugin_2.6.0~debian-bullseye_amd64.deb ...
Unpacking docker-compose-plugin (2.6.0~debian-bullseye) ...
Selecting previously unselected package docker-scan-plugin.
Preparing to unpack .../5-docker-scan-plugin_0.17.0~debian-bullseye_amd64.deb ...
Unpacking docker-scan-plugin (0.17.0~debian-bullseye) ...
Selecting previously unselected package slirp4netns.
Preparing to unpack .../6-slirp4netns_0.4.3-1_amd64.deb ...
Unpacking slirp4netns (0.4.3-1) ...
Setting up slirp4netns (0.4.3-1) ...
Setting up docker-scan-plugin (0.17.0~debian-bullseye) ...
Setting up containerd.io (1.6.7-1) ...
Setting up docker-compose-plugin (2.6.0~debian-bullseye) ...
Setting up docker-ce-cli (5:20.10.17~3-0~debian-bullseye) ...
Setting up docker-ce-rootless-extras (5:20.10.17~3-0~debian-bullseye) ...
Setting up docker-ce (5:20.10.17~3-0~debian-bullseye) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.17) ...
root@<my-server-name>:~# sudo nano /etc/apt/sources.list.d/docker.list
root@<my-server-name>:~# docker --version
Docker version 20.10.17, build 100c701
root@<my-server-name>:~# hostnamectl

因此,再次感谢@Prashant Abdare 分享这个解决方案,并感谢@Deep Kakkar 最近的编辑。