Reputation: 93
I am using AWS ec2 instance as private git repository. This instance is also used for running Dockerfile and docker file tries to checkout code from this private repository. My basic setup is done as per https://alvinabad.wordpress.com/2013/03/23/how-to-specify-an-ssh-key-file-with-the-git-command/ option 2. However, when i am running my docker build command:
$ sudo docker build -t "spring-petclinic" .
The build script stops at line:
RUN /root/.ssh/git.sh -i /root/.ssh/.pem clone [email protected]:/usr/local/git-repos/spring-petclinic.git
and gets following error:
"Cloning into 'spring-petclinic'... Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists."
I have search through google for this type of error, on similar kind of setup, but unable to search for.
Please help!!!
Thanks
Upvotes: 5
Views: 3132
Reputation: 24483
The problem that you're seeing is that it's connecting for the first time to an unknown host and SSH plays it safe by default. If you were running the command interactively, you'd get prompted to add the key to your known_hosts file.
You can either add the host key to the known_hosts
file (better) or set StrictHostKeyChecking
to no
in the ssh config (worse).
Upvotes: 5