How to run git clone from docker file requiring SSL certificate

Viewed 6434

I have the following code in my Dockerfile:

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

However, I'm getting this error:

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

I actually have a local git and I can't disable SSL certificate.

1 Answers

Try and add to your Dockerfile, before the git clone:

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

From there, as commented, you can clone the repo with an HTTPS URL like:

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