Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
101 views
in Technique[技术] by (71.8m points)

python - Can't access https inside docker container

I'm getting following error when use the curl command to an internal server.

Successfully set certificate verify locations: *   CAfile: none   CApath: /etc/ssl/certs * 
TLSv1.3 (OUT), TLS handshake, Client hello (1): * error:1408F10B:SSL 
routines:ssl3_get_record:wrong version number * Closing connection 0 curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number root@0541b093747a:/#

I can't access internal artifactory server to download any python packages using pip. my Dockerfile contains following

RUN pip3 -vvv install -r /requirements.txt --trusted-host artifactory.int.net

I'm getting the following error when dockerfile try to download python package using pip inside.

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='artifactory.internal', port=443): Read timed out. (read timeout=15)",)': /artifactory/api/pypi/org.python.pypi/simple/filelock/

I'm running Docker desktop version 2.1.0.3, running on Mac catalina 10.15.7

I can access the artifactory outside the container

* Uses proxy env variable https_proxy == 'http://127.0.0.1:3128'
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 3128 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to artifactory.internal:443
> CONNECT artifactory.internal:443 HTTP/1.1
> Host: artifactory.internal:443
> User-Agent: curl/7.64.1
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection established
<
* 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/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* CONNECT phase completed!
* CONNECT phase completed!
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate: CN=artifactory.internal
*  start date: Oct 30 00:00:00 2020 GMT
*  expire date: Oct 31 23:59:59 2021 GMT
*  subjectAltName: host "artifactory.internal" matched cert's "artifactory.internal"
*  issuer: C=US; O=DigiCert Inc; CN=DigiCert SHA2 Secure Server CA
*  SSL certificate verify ok.
> GET / HTTP/1.1
> Host: artifactory.internal
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
< Server: nginx/1.14.0
< Date: Fri, 29 Jan 2021 06:12:25 GMT
< Content-Type: text/html
< Content-Length: 161
< Location: https://artifactory.internal/artifactory/webapp/
< Connection: keep-alive
<
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.14.0</center>
</body>
</html>
* Connection #0 to host 127.0.0.1 left intact
* Closing connection 0
question from:https://stackoverflow.com/questions/65948416/cant-access-https-inside-docker-container

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...