I've set up a new Docker registry and I created my first build plan that would use it. I set up a Docker build task and a Docker push task.
I created shared credentials for my Docker registry and set to use those in my push task.
But now I ran into a problem: For some reason the push task tries to log out of the new registry but it has never logged into it yet.
simple 08-Jul-2019 11:28:54 Starting task 'Push image' of type 'com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli' command 08-Jul-2019 11:28:54 Beginning to execute external process for build 'X - Default Job #4 (SYN-GATE-JOB1-4)'\n ... running command line: \n/usr/bin/docker logout truncated.registry.tld\n ...
Thus that is causing my build to fail with an error:
build 08-Jul-2019 11:28:55 Not logged in to truncated.registry.tld error 08-Jul-2019 11:28:55 Error occurred while running Task 'Push image(3)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli.
How can I fix this?
We had a slightly similar support case recently, so I'm paraphrasing parts of our insights back then to hopefully help you narrow down the root cause:
Not logged in to truncated.registry.tldI can reproduce this by providing an erroneous password for one of our own repositories:
Not logged in to [...].dkr.ecr.us-east-1.amazonaws.com
Removing login credentials for [...].dkr.ecr.us-east-1.amazonaws.com
So your provided credentials are seemingly not working - I have encountered two different root causes:
I. Credentials copy & paste error
Is it possible that you have e.g. accidentally pasted the username (or resp. Bamboo variable) into both the 'Username' and the 'Password' fields of the Bamboo Docker task?
This still happens to me every now and then, because the 'Password' field is masked, making it difficult to verify whether one has actually copied and pasted the correct snippet into the field. And it has indeed also been the root cause for our support case, i.e. our customer ran into the very same usability issue.
II. Outdated Docker version
This is explained in more detail in our resp. KB Bamboo Docker task fails due to ProcessException: Error executing '/usr/bin/docker login ...', exit code: 125, here's the TL;DR:
Under the hood, the Bamboo Docker task is using a docker login command line including the meanwhile unsupported --email or -e flag, as confirmed by the resp. issue Docker Task: -e required for docker push command (BAM-18613). The --email or -e flag has been removed as of Docker version 17.06.0-ce, so an upgrade to this or a newer Docker version without an accompanying upgrade of the Bamboo Docker task will yield the exception at hand.
You should upgrade to a newer Bamboo release that addresses this problem - according to Docker Task: -e required for docker push command (BAM-18613) the first version that includes this fix seems to be 6.2.0.
If you cannot upgrade your Bamboo version right away, you might be able to apply one of the workarounds outlined on BAM-18613.
Indeed this was the case.
The registry uses robot accounts and the passwords generated for those are pretty long. My only theory was that yesterday my clipboard was not copying the password entirely. I went over the password again and sure enough, my images were pushing to the registry.
Thank-you very much for the help and also describing a previous case where this was found, it was a good read.