Docker automated build fails

I’ve been experiencing this failure since the roughly the 25th on docker cloud. I have a private repo in BitBucket and a private docker image from where I normally ran automated builds on PR’s and branch merges.

Both are connected and now I get this error:

ERROR: Build failed: please ensure the correct public key is added to the list 
of trusted keys for this repository (128)
ERROR: Build failed with exit code 2
ERROR: Build in 'foo-bar' (ef7710f2) failed in 0:00:11

OR

ERROR: Error when trying to create deploy key
ERROR: Build in 'foo-bar' (ef7710f2) failed in 0:00:02

OR

Building in Docker Cloud's infrastructure...
Cloning into '.'...
Warning: Permanently added the RSA host key for IP address 'xxx.xxx.xxx.x' to 
the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
please ensure the correct public key is added to the list of trusted keys for 
this repository (128)

In BitBucket the access key is automatically added
bitbucket access key

If I remove and readd the BitBucket account to docker cloud and add & remove the oauth of docker cloud on BitBucket it works for one build but fails on the next one. Hence voiding the whole automated build functionality. Now I’m super confused - is this an error on my side, BB or docker cloud?

Lastly, am I correct in saying that the above mentioned Access Key that is created by Docker cloud should have access to this repository as the Private Key resides on docker clouds’ side and match it to this public key Docker Cloud Build?

Any help will be greatly appreciated as it’s been a very frustrating 24-hours.

1 Like

I had the same exact issue. I made several attempts to delete the access key in Bitbucket and connect again from Docker but it would not work on the second build. So I removed the automated builds from Docker and decided to build directly from Bitbucket pipeline. Bitbucket pipelines support direct build of docker images and pushes for you to docker registry. At least that solved it for my case.