I want to download and install a github repository inside a docker container. My strategy is to create a docker image from a Dockerfile, which works fine if I installed an repository without submodules. The Dockerfile:
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y git
RUN mkdir /home/example && cd /home/example && git clone https://github.com/example/example.git
RUN cd /home/example/example && python3 setup install
When I want to use submodules
RUN cd /home/example/example && git submodule update --init --recursive
I get the Error Host key veriffication failed fatal: Could not read from remote repisitory. Plead make scure you have the correct access rights
#0 0.705 Please make sure you have the correct access rights
#0 0.705 and the repository exists.
#0 0.708 fatal: clone of 'git@github.com:example/example.git' into submodule path '/home/example/example/third_party/exampleLib' failed
#0 0.708 Failed to clone 'third_party/exampleLib'. Retry scheduled
#0 0.714 Cloning into '/home/example/example/third_party/otherLib'...
#0 1.160 Host key verification failed.
#0 1.162 fatal: Could not read from remote repository.
When I try to install the submoduls direct in the docker container with the command:
root@<containerid>:/home/example/example# git submodule update --init --recursive
I get the error
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Why I can download the repository but not the submodules? -> All submodules are public! Is it possible to add all ssh informations from the local git to use it for cloning inside the docker container?