Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Pipeline Docker run - git@bitbucket.org: Permission denied (publickey).

Bartolome Jimenez Vera March 10, 2021

I have a Dockerfile within my repository, which I use to build our code. In order to build the code, I need to clone other bitbucket repositories.

I've been developing from inside the same container, and have been able to clone/pull without problems locally.

I also had some problems with authenticating the host, but I solved this by adding

`echo "bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==" >> ~/.ssh/known_hosts`

in my dockerfile.

 

The problem is that when running on the pipe, it fails to authenticate. However, if on the same build step, I try to clone the repository, it'll do it without any problems. So, I know the ssh keys are set correctly.

There's a similar post open https://community.atlassian.com/t5/Bitbucket-questions/Dockerfile-Host-key-verification-failed/qaq-p/1035415 , but also with no answer, and I also have the same issue that the known_hosts or config are not available to my docker in docker. As well, as trying to mount them brings a "forbidden"

 

Any help would be appreciated.

1 answer

0 votes
Denys Kovalko March 10, 2021

Try to add this command:

ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts
Bartolome Jimenez Vera March 10, 2021

Unfortunately, this is only useful when I get host validation errors, I'm past that point. The problem is that my ssh-agent is not forwarded to my docker, and I can't copy the config or known_hosts.

but thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events