Git clone docker file SSL issue

Hi Team,

We are using GitHub Enterprise version 3.0.3 in one of our projects and we are trying to clone one of the repos in docker file by using the below command

RUN git clone https://reponame /src .

It was giving an error as shown below

Fatal : Unable to access repo , SSL certificate problem , Unable to get local issuer certificate.

Additional details:

Our repository is hosted on our Internal network and only be accessible with in our VDI with the name

Can you please help us here regarding the fix to pass the required certificates here .

Please let me know if you need any additional certificates

You will have to add the appropriate CA (or self-signed certificate) as trusted inside the container image. How to do that has nothing to do with GitHub, it depends on the base image you are using and how it handles certificates.

That said, cloning the repository into the container image is likely a bad idea:

  • The Docker cache won’t notice if the remote repository changes, so you won’t get updates with the next docker build. :warning:
  • Unless you’re using a multi-stage build and the stage with the repository is not the final one, having the whole history in the container unnecessarily increases the size of the image.

Hi @airtower-luna ,

Thanks for the details , As you mentioned closing the repo is a bad practice as we are looking for another alternative like copying required files using COPY command in docker and will run npm install command .

But Here we are using Github packages and using github enterprise version 3.0 , So when we run npm install it is trying to install npm packages , But we are getting an error saying “ssl verification problem : Unable to get local issuer certificate”

Any Idea how can we resolve the issue , I know we need to map Npm config set to that cert file , But how to do that in docker file as you certs will be in host . Can you please let me know how this can be fixed ?

I’m not familiar enough with NPM to give detailed instructions, but in principle it should work just like on the host, except you have to do it using instructions in the Dockerfile. COPY the certificate into the container, then RUN whatever is needed to adjust the configuration to accept that certificate. Or maybe you can COPY a prepared configuration file, too.