Git无法从Docker容器克隆公共存储库

时间:2019-10-18 13:24:20

标签: git docker ssl curl

我正在尝试使用包含以下命令的dockerfile构建docker映像。

RUN GIT_CURL_VERBOSE=1 git clone --depth=1 -b  master https://code.aliyun.com/SmileYang/adaptive-loadbalance.git

构建docker映像时出现错误:

 ---> Running in 89727fcab44a
+ GIT_CURL_VERBOSE=1 git clone --depth=1 -b master https://code.aliyun.com/SmileYang/adaptive-loadbalance.git
Cloning into 'adaptive-loadbalance'...
* Couldn't find host code.aliyun.com in the .netrc file; using defaults
*   Trying 120.55.150.20...
* TCP_NODELAY set
* Connected to code.aliyun.com (120.55.150.20) port 443 (#0)
* found 151 certificates in /etc/ssl/certs/ca-certificates.crt
* found 604 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* Operation timed out after 300014 milliseconds with 0 out of 0 bytes received
* Curl_http_done: called premature == 1
* stopped the pause stream!
* Closing connection 0
fatal: unable to access 'https://code.aliyun.com/SmileYang/adaptive-loadbalance.git/': Operation timed out after 300014 milliseconds with 0 out of 0 bytes received

我尝试在没有docker的情况下运行git clone命令,并且得到以下输出:

aijiaming@ubuntu:~$ GIT_CURL_VERBOSE=1 git clone --depth=1 -b master https://code.aliyun.com/SmileYang/adaptive-loadbalance.git
Cloning into 'adaptive-loadbalance'...
* Couldn't find host code.aliyun.com in the .netrc file; using defaults
*   Trying 120.55.150.20...
* Connected to code.aliyun.com (120.55.150.20) port 443 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 594 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
*        server certificate verification OK
*        server certificate status verification SKIPPED
*        common name: code.aliyun.com (matched)
*        server certificate expiration date OK
*        server certificate activation date OK
*        certificate public key: RSA
*        certificate version: #3
*        subject: C=CN,ST=ZheJiang,L=HangZhou,O=Alibaba (China) Technology Co.\, Ltd.,CN=code.aliyun.com
*        start date: Wed, 09 Oct 2019 02:01:07 GMT
*        expire date: Fri, 09 Oct 2020 02:01:07 GMT
*        issuer: C=BE,O=GlobalSign nv-sa,CN=GlobalSign Organization Validation CA - SHA256 - G2
*        compression: NULL
* ALPN, server accepted to use http/1.1
> GET /SmileYang/adaptive-loadbalance.git/info/refs?service=git-upload-pack HTTP/1.1

------------------more output-------------------------

这是一个类似的问题:

git clone fails with Operation timed out after 0 milliseconds with 0 out of 0 bytes received

我不知道为什么它在ALPN, offering http/1.1停了下来,看来这是与 SSL 相关的问题。

git版本为 2.11.0

0 个答案:

没有答案