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

问题描述 投票:3回答:1

我的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证书。

git docker ssl alpine
1个回答
3
投票

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

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

从那里,如评论所示,您可以使用HTTPS URL克隆repo,如:

https://username:[email protected]/project_name.git 
© www.soinside.com 2019 - 2024. All rights reserved.