I have gitlab runner installed on kubernetes
. I am trying to build docker image from a Dockerfile which needs to clone private repositories over ssh. I have added ssh-keyscan to get public key of the repo URL.
It throws following error most of the times :
write (git..com): Operation timed out
I have tried increasing timeout but the behaviour is still the same.
This is the command I am running from Dockerfile
RUN mkdir -p -m 0600 /root/.ssh && ssh-keyscan -vvv -T 300 -p <port> git.<kygitlab>.com >> /root/.ssh/known_hosts
The public key should be stored into know_hosts
file without any error. This works fine in my local system but throws an error when executed with gitlab CI on kubernetes.
The problem is:
need
a private/public key pair (in the ~/.ssh
Docker image folder), with the public key registered on the remote private repo hosting service side.Only that would allow you to access and clone a private remote repo.