Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git在http代理后面的dockerfile中不工作_Git_Docker_Http_Ssl Certificate - Fatal编程技术网

Git在http代理后面的dockerfile中不工作

Git在http代理后面的dockerfile中不工作,git,docker,http,ssl-certificate,Git,Docker,Http,Ssl Certificate,我已经尝试解决这个问题好几天了,但都没有成功 设置如下:一切都在公司防火墙后运行。我有一个带有ubuntu图像的dockerfile。防火墙后一切正常,我已经设置了证书和代理设置。唯一不起作用的是git。我不能克隆任何东西 我已按如下方式设置证书和代理: RUN git config --global http.proxy http://165.225.80.41:80 RUN git config --global http.sslCAPath /usr/local/share/ca-cert

我已经尝试解决这个问题好几天了,但都没有成功

设置如下:一切都在公司防火墙后运行。我有一个带有ubuntu图像的dockerfile。防火墙后一切正常,我已经设置了证书和代理设置。唯一不起作用的是git。我不能克隆任何东西

我已按如下方式设置证书和代理:

RUN git config --global http.proxy http://165.225.80.41:80 RUN git config --global http.sslCAPath /usr/local/share/ca-certificates/abcd/abcd.crt
RUN git config --global http.sslCAInfo /usr/local/share/ca-certificates/abcd/abcd.crt
RUN git clone https://github.com/asd/asd.git
这是我运行它时得到的结果:

Step 39/156 : RUN git clone https://github.com/asd/asd.git
 ---> Running in e20ef1c7ac5d
Cloning into 'asd'...
error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated
错误:RPC失败;curl 56 GnuTLS recv error(-110):TLS 连接是不正确的

错误不是来自代理,也不是由于代理,而是来自git,可能是安装不正确,也可能是安装过程中遗漏了某些内容

可能的解决办法

如果未安装,请安装OpenSSL

RUN sudo apt install openssl
尝试ssh

RUN git clone git@github.com/asd/asd.git
您可以进一步检查可能的原因

或者你可以试试

RUN git config --global http.proxy http://165.225.80.41:80 && \
git config --global http.sslCAPath /usr/local/share/ca-certificates/abcd/abcd.crt && \
git config --global http.sslCAInfo /usr/local/share/ca-certificates/abcd/abcd.crt && \
git clone https://github.com/asd/asd.git

问题不是git的代理设置。Git在UbuntuLTS中无法正常工作,因为GnuTLS。只有在某些情况下,在代理后使用Ubuntu时才会失败。唯一的解决方案是使用OpenSSL而不是GnulTLS从源代码重建git

这似乎是解决问题的一种非常复杂的方法,但在此之前我尝试了许多不同的解决方案,但都不起作用。以下是我尝试过的东西的摘要:

  • Linux环境变量
  • git和Linux的证书+代理设置
  • Docker设置、环境和州保护
  • 重新安装Git和GnuTLS
  • 将ubuntu更新为Ubuntu18
  • 使用Wget克隆,将克隆卷曲到容器外并复制