Docker Python请求导致DH KEY TOO SMALL错误的结果 [英] Docker python requests results in DH KEY TOO SMALL error
问题描述
我正在尝试设置一个使用请求库从网站获取数据的python脚本.该脚本可以正常运行,而在Windows 10 pc或azure vm的虚拟环境中运行时不会出现问题.
I'm trying to setup a python script that uses the requests library to get data from a website. The script works without issues running in a virtual environment on my windows 10 pc or on a azure vm.
但是,当我尝试使用python:3.6-slim
映像创建docker容器时,出现DH_KEY_TOO_SMALL错误.在ssllabs.com上测试该网站显示,它支持弱DH密钥交换参数.是什么原因导致此错误,我该如何解决?
However, when I try to create a docker container using the python:3.6-slim
image I get DH_KEY_TOO_SMALL errors. Testing the website on ssllabs.com revealed that it supports weak DH key exchange parameters. What could be causing this error and how can I fix it?
推荐答案
我已设法解决了该问题.该问题是由openssl版本引起的.我的Windows 10 pc和ubuntu 18.04 vm都运行较旧的版本,连接到网站没有问题. python docker映像包含拒绝连接的更新版本的openssl.
I've managed to fix the issue. The problem was caused by openssl versions. Both my windows 10 pc and ubuntu 18.04 vm run an older version that had no problem connecting to the website. The python docker images contain a newer version of openssl that refused to connect.
这篇关于Docker Python请求导致DH KEY TOO SMALL错误的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!