WSL环境下Docker无法获取本地颁发者证书问题求助
Windows-WSL-Docker环境下容器内SSL证书验证失败问题
我在Windows-WSL-Docker环境中遇到了容器内的SSL证书验证问题:WSL本身可以正常连接HTTPS URL,但通过Dockerfile构建容器,或者在现有容器内执行需要SSL的命令时,会出现证书验证失败的错误。
比如执行curl -vfsSL https://apt.releases.hashicorp.com/gpg时,返回错误如下:
* Expire in 50 ms for 1 (transfer 0x55b609930110) * TLSv1.3 (IN), TLS handshake, Server hello (2): * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): * TLSv1.3 (IN), TLS handshake, Certificate (11): * TLSv1.3 (OUT), TLS alert, unknown CA (560): * SSL certificate problem: unable to get local issuer certificate * 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 failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.
我已经尝试过以下方法,但都没有效果:
- 使用
--insecure参数跳过证书验证 - 在Dockerfile构建过程中安装
ca-certificates并更新证书
当前使用的Docker版本信息:
- Docker version 20.10.8, build 3967b7d
- docker-compose version 1.29.2, build 5becea4c
内容的提问来源于stack exchange,提问作者Gino Pane
相关产品推荐
相关产品推荐

