2017-06-22 69 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環境的情況下,我只能訪問通過證書管理器的證書 - 是否應該導出並使用該路徑?我在找哪個證書? –

相關問題