如何从需要SSL证书的Docker文件运行git clone

时间:2018-08-28 23:05:01

标签: git docker ssl alpine

我的Dockerfile中包含以下代码:

FROM alpine/git as clone 
WORKDIR /app
RUN git clone https://github.com/spring-projects/spring-petclinic.git

但是,我遇到此错误:

fatal: unable to access 'https://github.com/spring-projects/spring-petclinic.git/': SSL certificate problem: self signed certificate in certificate chain

我实际上有一个本地git,并且无法禁用SSL证书。

1 个答案:

答案 0 :(得分:3)

尝试将git clone之前的 添加到您的Dockerfile中:

RUN apk add --update \
       ca-certificates \
    && update-ca-certificates

如前所述,您可以从此处使用HTTPS URL克隆存储库,例如:

https://username:password@some.company.com/project_name.git