我仍然有同样的问题。上面的答案似乎都没有解决它。
我有 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.conf.d/99proxy
Acquire::http::Proxy {
localhost DIRECT;
localhost:9020 DIRECT;
localhost:9021 DIRECT;
};
我在sources.list 中使用不同的条目进行了以下测试
测试条目 1:
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.
失败
测试条目 2:
deb [arch=amd64] http://localhost:9020/linux/ubuntu xenial stable
/etc/apache2/sites-enabled/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
成功
测试条目 3:
deb [arch=amd64] https://localhost:9021/linux/ubuntu xenial stable
/etc/apache2/sites-enabled/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 fetch 以及 Release 文件的 url 实际上可以使用相同的代理配置从 browser / wget / curl 访问。
apt-get 仅适用于 http 反向代理 url 这一事实意味着存在一些从 https 连接中访问资源的问题。
我不知道这个问题是什么,但apt-get 应该会显示更多信息(apt 更简洁)。
注意:wiresharking case 1显示代理CONNECT成功,并没有发送RST,当然文件也无法读取。