我在尝试安装 docker-ce 而不是 Debian Stretch 上的过时发行版软件包时遇到了一个奇怪的问题。我逐字逐句地遵循了他们的简单指南:
https://docs.docker.com/install/linux/docker-ce/debian/
密钥存在且已验证,并且生成的 sources.list 行看起来符合预期:
deb [arch=amd64] https://download.docker.com/linux/debian stretch stable
但是,重新下载软件包列表(否则为 stretch、stretch-updates 和 debian-security)会导致以下结果:
W: The repository 'https://download.docker.com/linux/debian stretch Release' does not have a Release file.
E: Failed to fetch https://download.docker.com/linux/debian/dists/stretch/stable/binary-amd64/Packages
完整apt-get update
输出:
Get:1 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Ign:2 https://download.docker.com/linux/debian stretch InRelease
Ign:3 https://download.docker.com/linux/debian stretch Release
Ign:4 https://download.docker.com/linux/debian stretch/stable amd64 Packages
Ign:5 https://download.docker.com/linux/debian stretch/stable all Packages
Ign:6 https://download.docker.com/linux/debian stretch/stable Translation-en
Ign:7 https://download.docker.com/linux/debian stretch/stable Translation-en_US
Ign:8 https://download.docker.com/linux/debian stretch/stable all Contents (deb)
Ign:9 https://download.docker.com/linux/debian stretch/stable amd64 Contents (deb)
Ign:10 https://download.docker.com/linux/debian stretch all Contents (deb)
Ign:11 https://download.docker.com/linux/debian stretch amd64 Contents (deb)
Ign:4 https://download.docker.com/linux/debian stretch/stable amd64 Packages
Ign:5 https://download.docker.com/linux/debian stretch/stable all Packages
Ign:6 https://download.docker.com/linux/debian stretch/stable Translation-en
Ign:7 https://download.docker.com/linux/debian stretch/stable Translation-en_US
Ign:8 https://download.docker.com/linux/debian stretch/stable all Contents (deb)
Ign:9 https://download.docker.com/linux/debian stretch/stable amd64 Contents (deb)
Ign:10 https://download.docker.com/linux/debian stretch all Contents (deb)
Ign:11 https://download.docker.com/linux/debian stretch amd64 Contents (deb)
Ign:4 https://download.docker.com/linux/debian stretch/stable amd64 Packages
Ign:5 https://download.docker.com/linux/debian stretch/stable all Packages
Ign:6 https://download.docker.com/linux/debian stretch/stable Translation-en
Ign:7 https://download.docker.com/linux/debian stretch/stable Translation-en_US
Ign:8 https://download.docker.com/linux/debian stretch/stable all Contents (deb)
Ign:9 https://download.docker.com/linux/debian stretch/stable amd64 Contents (deb)
Ign:10 https://download.docker.com/linux/debian stretch all Contents (deb)
Ign:11 https://download.docker.com/linux/debian stretch amd64 Contents (deb)
Ign:4 https://download.docker.com/linux/debian stretch/stable amd64 Packages
Ign:5 https://download.docker.com/linux/debian stretch/stable all Packages
Ign:6 https://download.docker.com/linux/debian stretch/stable Translation-en
Ign:7 https://download.docker.com/linux/debian stretch/stable Translation-en_US
Ign:8 https://download.docker.com/linux/debian stretch/stable all Contents (deb)
Ign:9 https://download.docker.com/linux/debian stretch/stable amd64 Contents (deb)
Ign:10 https://download.docker.com/linux/debian stretch all Contents (deb)
Ign:11 https://download.docker.com/linux/debian stretch amd64 Contents (deb)
Ign:4 https://download.docker.com/linux/debian stretch/stable amd64 Packages
Ign:5 https://download.docker.com/linux/debian stretch/stable all Packages
Ign:6 https://download.docker.com/linux/debian stretch/stable Translation-en
Ign:7 https://download.docker.com/linux/debian stretch/stable Translation-en_US
Get:12 http://security.debian.org/debian-security stretch/updates/main Sources [195 kB]
Ign:8 https://download.docker.com/linux/debian stretch/stable all Contents (deb)
Ign:9 https://download.docker.com/linux/debian stretch/stable amd64 Contents (deb)
Ign:10 https://download.docker.com/linux/debian stretch all Contents (deb)
Ign:11 https://download.docker.com/linux/debian stretch amd64 Contents (deb)
Err:4 https://download.docker.com/linux/debian stretch/stable amd64 Packages
Ign:5 https://download.docker.com/linux/debian stretch/stable all Packages
Ign:6 https://download.docker.com/linux/debian stretch/stable Translation-en
Ign:7 https://download.docker.com/linux/debian stretch/stable Translation-en_US
Get:13 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [476 kB]
Ign:8 https://download.docker.com/linux/debian stretch/stable all Contents (deb)
Ign:9 https://download.docker.com/linux/debian stretch/stable amd64 Contents (deb)
Ign:10 https://download.docker.com/linux/debian stretch all Contents (deb)
Ign:11 https://download.docker.com/linux/debian stretch amd64 Contents (deb)
Get:14 http://security.debian.org/debian-security stretch/updates/main Translation-en [211 kB]
Ign:15 http://ftp.us.debian.org/debian stretch InRelease
Get:16 http://ftp.us.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:17 http://ftp.us.debian.org/debian stretch Release [118 kB]
Get:18 http://ftp.us.debian.org/debian stretch-updates/main Sources [14.3 kB]
Get:19 http://ftp.us.debian.org/debian stretch-updates/main amd64 Packages [11.1 kB]
Get:20 http://ftp.us.debian.org/debian stretch-updates/main Translation-en [11.1 kB]
Get:21 http://ftp.us.debian.org/debian stretch-updates/main amd64 Contents (deb) [352 kB]
Get:22 http://ftp.us.debian.org/debian stretch Release.gpg [2,434 B]
Get:23 http://ftp.us.debian.org/debian stretch/main Sources [6,746 kB]
Get:24 http://ftp.us.debian.org/debian stretch/main amd64 Packages [7,084 kB]
Get:25 http://ftp.us.debian.org/debian stretch/main Translation-en [5,384 kB]
Get:26 http://ftp.us.debian.org/debian stretch/main amd64 Contents (deb) [31.4 MB]
Fetched 52.2 MB in 13s (3,784 kB/s)
Reading package lists... Done
W: The repository 'https://download.docker.com/linux/debian stretch 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/debian/dists/stretch/stable/binary-amd64/Packages
E: Some index files failed to download. They have been ignored, or old ones used instead.
两者都curl
可以wget
毫无问题地提取 apt 所抱怨的确切 URL,并且在详细日志中没有显示任何值得注意的内容。
看看strace
,我看到了这一点:
read(5, "400 URI Failure\nURI: https://download.docker.com/linux/debian/dists/stretch/stable/binary-all/Packages\nMessage: \n\n400 URI Failure\nURI: https://download.docker.com/linux/debian/dists/stretch/stable/binary-amd64/Packages\nMessage: \n\n400 URI Failure\nURI: https://download.docker.com/linux/debian/dists/stretch/stable/i18n/Translation-en\nMessage: \n\n400 URI Failure\nURI: https://download.docker.com/linux/debian/dists/stretch/stable/i18n/Translation-en_US\nMessage: \n\n", 64000) = 461
stat("/var/lib/apt/lists/partial/download.docker.com_linux_debian_dists_stretch_stable_binary-all_Packages", 0x7ffded218d60) = -1 ENOENT (No such file or directory)
unlink("/var/lib/apt/lists/partial/download.docker.com_linux_debian_dists_stretch_stable_binary-all_Packages") = -1 ENOENT (No such file or directory)
stat("/var/lib/apt/lists/download.docker.com_linux_debian_dists_stretch_Contents-all.lz4", 0x7ffded218b80) = -1 ENOENT (No such file or directory)
stat("/var/lib/apt/lists/partial/download.docker.com_linux_debian_dists_stretch_Contents-all", 0x7ffded218bd0) = -1 ENOENT (No such file or directory)
write(1, "Ign:4 https://download.docker.com/linux/debian stretch/stable all Packages\n", 75Ign:4 https://download.docker.com/linux/debian stretch/stable all Packages
) = 75
stat("/var/lib/apt/lists/partial/download.docker.com_linux_debian_dists_stretch_stable_binary-amd64_Packages", 0x7ffded218d60) = -1 ENOENT (No such file or directory)
unlink("/var/lib/apt/lists/partial/download.docker.com_linux_debian_dists_stretch_stable_binary-amd64_Packages") = -1 ENOENT (No such file or directory)
write(1, "Err:5 https://download.docker.com/linux/debian stretch/stable amd64 Packages\n", 77Err:5 https://download.docker.com/linux/debian stretch/stable amd64 Packages
400 URI 失败之前已经讨论过,例如这里:https://askubuntu.com/questions/493180/method-gave-invalid-400-uri-failure-message-when-running-apt-get-update#497377
但是,它似乎并不是相同的区域设置问题 - 运行相同的测试wget
我看到它使用en_US.UTF-8
并且这是我的locale
输出:
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
所以,没什么特别的。这几乎是一个标准的 Debian Stretch 安装,除了获得、和其他类似的标准应用程序外,没有做太多apache2
其他事情sendmail
。dovecot
我没有在 $http_proxy、任何配置文件 / bashrc 文件或专门为 apt 配置代理。我找不到好的开放式 HTTPS 代理,似乎无法拼凑一个,但允许几个字节通过的代理也显示了 400 错误,所以我的 VPS 提供商不太可能对我耍什么花招。(如果他们甚至可以使用 HTTPS - 我和 RamNode 一起推荐使用他们的 KVM 之一进行 Docker 使用。)我的 Sid 桌面配置更加黑客化,在下载文件时没有问题,就像有人在 Docker IRC 上使用 Stretch 一样,这至少有点奇怪。
我没什么主意了,现在只能手动安装,虽然可行,但当然不是一个好主意。您猜问题可能出在哪里?
编辑:好吧,我现在已经束手无策了。我设置了mitmproxy
以捕获到 的流量download.docker.com
。我将其配置为反向代理,将代理 IP 放入表中hosts
并再次download.docker.com
执行apt-get update
。它完美地通过了,请求在 Wireshark 中看起来像完全正常的 HTTP/1.1,并且也通过了openssl
。编码只是 ASCII(兼容)。
如果有人知道如何解释这一点,请解释一下。我可以进行 MITM mitmproxy
(由于强制 HTTPS,无法直接到端口 80)并比较代理系统上的传入和传出请求,但我怀疑它不会产生任何结果,而且我已经很头疼了……
编辑2:将 Testes 与第二台 Debian Stable 机器(可正确更新)进行比较。根据 Wireshark,它们发送的请求是相同的,字节对字节。
答案1
解决方案(某种程度上)
它之所以能成功,mitmproxy
是因为我禁用了证书验证 - 有了这种配置,我就不需要代理了。我不知道证书验证失败如何会导致 400 错误,因为 HTTP 通信本来就不应该发生,但显然这里发生了一些超出我专业水平的事情。如果有人在 HTTPS repo 中遇到类似问题,至少有一个解决方法可以尝试...