Issue with Automated Build - ERROR: Error when trying to create deploy key

Hey all, first time here,

I’m using the free version of cloud docker as a trial basis for the eventuality of purchasing an enterprise license of Docker Cloud for CI/CD. I have an integration with BitBucket set up and an automated trigger to build upon commit. So far I made 9 successful builds, however as of today, I’m having problems with the automated build. The build is failing automatically and I’m receiving an e-mail stating

ERROR: Error when trying to create deploy key
ERROR: Build in 'master:/ToDoList:/ToDoList.Web/Dockerfile' (731913ce) failed in 0:00:01 

When I go to the build task to view additional information, I can’t seem to find anything which might help me pin point what exactly the issue is. Here’s a screenshot:

Would anyone be able to point me towards the right direction as to what might be the problem?

Kind regards,


Edit: Screenshot of previous success builds:

Following what can only be explained as an arduous 20 hours, I performed the following operations to finally get a successful build:

  1. Unlink BitBucket provider from Docker Cloud
  2. Remove Docker Cloud access from BitBucket OAuth
  3. Create a new Docker Cloud repository, and relink Docker Cloud to Bit Bucket


Deleting a repository on Docker Cloud does not really delete it. (??!). As soon as you create a new repository with the same name, all the old build settings return - which makes me believe that other “hidden” settings and caches are not removed as well. So simply recreating the repository will not solve the above problem. It has to be a new repository with a new name.

I can fairly say that my experience so far with Docker Cloud has not been in any way pleasant, and none of the time-saving features have actually saved my time. To the contrary. But I digress.

1 Like

@andreamercieca did you solve that issue by the steps below?

Docker Cloud is failing big time, always something happens (softly saying, not pleasant).

Did not work for me on my end

I have solved this issue by this:

  1. Log into bitbucket, select repository - Settings > Access keys > and remove “Docker Cloud Build” key
  2. Log into docker cloud - Cloud settings > and disconnect Bitbucket and connect again
1 Like

Yes by doing the steps I outlined in my post, I have managed to make the manual and automated builds work again. However it seems that @analogic made it work without recreating the repository and just refreshing the access keys - however I recall doing just that and still no go. So it seems that there might be multiple ways to tackle a seemingly similar issue. However, without better logs from Docker Cloud, we can’t really pinpoint what went wrong and what we’re fixing.

Yep, thank you for hints at other thread: Error: Build in 'master' (90c89f58)

I guess that bitbucket don’t accept old key anymore (dsa?) or docker cloud started using new keys and forgot push public key to bitbucket. Anyway I agree that logs are not very helpful

1 Like

What I’m experiencing is, it will only build successfuly once, after that the fail will be continuous fail. I already tried your suggestions

I have same problem, autobuild stopped working again. Now it seems that docker cloud bitbucket ssh key management is broken. Creating custom key and pasting it to SSH_PRIVATE and bitbucket should work

Who is at fault here docker cloud or bitbucket?

Creating CUSTOM_KEY is just creating access keys manually in Bitbucket right? What about SSH_PRIVATE?

I guess that docker cloud thinks that it needs to create new key and pushing to bitbucket fails because it is already there. SSH_PRIVATE is documented at

A little help please, I tried copy pasting the Access Key of Bitbucket as a value of SSH_PRIVATE but the build failed. The message is:

Building in Docker Cloud's infrastructure...
Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '' 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)

PS: The value came from the created ACCESS KEY from my first trigger build coming from Docker Cloud

Can confirm this worked for me(once)

Try to follow the instructions listed in @analogic comment a little further up this post. If that doesn’t work, create a whole new repository just for testing, connect it to the same BitBucket repository, set up the automated builds and test it out. If that works, I’m afraid you’re going to have to do the same thing I did; i.e. moving onto a new repository.

It finally worked when I manually added the ssh keys using keygen in my Mac

can you maybe explain in more detail what you did? It only seemed to work for me one time and I had to do it all over again :frowning:

@analogic is your automated builds still working? Did you end up creating a custom access key for the repo and using that public key in your SSH_PRIVATE environment variable in docker?

Your reply would be greatly appreciated

I have the same problem, it works one time after deleting the deployment keys. Where is the problem? At docker or bitbucket?

Same here! I’m super confused and not sure where this is failing :cry:

@continuon after creating custom key and setting SSH_PRIVATE autobuild is working as intended

Ok just to understand you correctly :slight_smile:

Did you create a custom “Access Key” on BB? and then you added that key to the SSH_PRIVATE on docker?