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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pipeline Docker run - Permission denied (publickey).

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 " 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 , 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

Try to add this command:

ssh-keyscan >> ~/.ssh/known_hosts

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
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,792 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you