2017-06-22 86 views
0

我刚开始使用python来利用第三方api来改进我们公司的工作流程。我一直在使用的一个API是用于citrix共享文件(一种安全的,受管理的FTP服务器)。我使用citrix编写的模块作为api调用的示例,以便在我正在编写的内容和实际的HTTP请求之间至少有一层抽象。运行python的Windows Docker容器中的证书验证错误

当我从我的笔记本电脑上获取访问令牌的认证请求时,这工作正常,但是当我尝试从docker容器(安装了python的windows nano)执行相同的操作时,我将此作为响应:

Traceback (most recent call last): 
    File "main.py", line 38, in <module> 
    sharefile = pysharefile.authenticate(hostname,sf_client_id,sf_client_secret,sf_username,sf_password) 
    File "C:\Python\lib\site-packages\pysharefile\pysharefile.py", line 42, in authenticate 
    http.request('POST', uri_path, urllib.parse.urlencode(params), headers=headers) 
    File "C:\Python\lib\http\client.py", line 1239, in request 
    self._send_request(method, url, body, headers, encode_chunked) 
    File "C:\Python\lib\http\client.py", line 1285, in _send_request 
    self.endheaders(body, encode_chunked=encode_chunked) 
    File "C:\Python\lib\http\client.py", line 1234, in endheaders 
    self._send_output(message_body, encode_chunked=encode_chunked) 
    File "C:\Python\lib\http\client.py", line 1026, in _send_output 
    self.send(msg) 
    File "C:\Python\lib\http\client.py", line 964, in send 
    self.connect() 
    File "C:\Python\lib\http\client.py", line 1400, in connect 
    server_hostname=server_hostname) 
    File "C:\Python\lib\ssl.py", line 401, in wrap_socket 
    _context=self, _session=session) 
    File "C:\Python\lib\ssl.py", line 808, in __init__ 
    self.do_handshake() 
    File "C:\Python\lib\ssl.py", line 1061, in do_handshake 
    self._sslobj.do_handshake() 
    File "C:\Python\lib\ssl.py", line 683, in do_handshake 
    self._sslobj.do_handshake() 
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) 

从我读过这可能是因为容器不能访问该证书在我的电脑上,但如果是这样,我怎么会在安装容器中的SSL证书?

感谢, 奥斯汀

回答

0

如果主机上的证书存储是与客人兼容,你可以直接安装它。

搬运工运行-v /主机/路径/到/证书:/集装箱/路径/到/证书-d IMAGE_ID“更新CA证书”

+0

在Windows环境的情况下,我只能访问通过证书管理器的证书 - 是否应该导出并使用该路径?我在找哪个证书? –