【发布时间】:2020-02-08 19:19:24
【问题描述】:
我在coporate proxy 后面有一个Ubuntu 18.04 server。
我设置了http_proxy 和https_proxy 环境变量。
服务器正在运行 Docker 19.03,它也被配置为使用 http_proxy 和 https_poxy。
如果在容器内运行docker run -it ubuntu:18.04,我可以执行apt update和apt install curl -y
然后我可以做类似curl www.google.com 的事情。
但它不适用于https:
root@1b6abfb4ff90:/# curl -v -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0* Trying 10.30.88.14...
* TCP_NODELAY set
* Connected to xxx (10.30.88.14) port 8080 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to raw.githubusercontent.com:443
> CONNECT raw.githubusercontent.com:443 HTTP/1.1
> Host: raw.githubusercontent.com:443
> User-Agent: curl/7.58.0
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connected
<
* Proxy replied 200 to CONNECT request
* CONNECT phase completed!
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* CONNECT phase completed!
* CONNECT phase completed!
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [91 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [2741 bytes data]
* TLSv1.2 (OUT), TLS alert, Server hello (2):
} [2 bytes data]
* SSL certificate problem: unable to get local issuer certificate
* stopped the pause stream!
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Closing connection 0
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html
curl 未能验证服务器的合法性,因此无法 建立与它的安全连接。要了解更多关于这种情况和 如何修复它,请访问上面提到的网页。
在容器之外,它工作正常。我还在另一台不在代理后面且在容器内工作的服务器上进行了完全相同的尝试。
所以我想这是 docker 守护进程的配置问题。或者也许我错了...... 解决办法是什么?
【问题讨论】:
-
您是否尝试安装
apt-get install ca-certificates? -
是的,它是最新的。它是用 curl 安装的。
-
能否提供
curl -v -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar的输出,好吗?还要检查容器中是否有证书颁发者的 CA 证书。 -
我更新了问题。如何检查容器中证书颁发者的 CA 证书是否可用?
标签: docker ssl curl ubuntu-18.04