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

Docker task tries to log out of a new private registry before it has even logged in

kurbar July 8, 2019

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?

1 answer

1 accepted

2 votes
Answer accepted
Steffen Opel _Utoolity_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 8, 2019

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:

  1. Inspecting the Docker task's source code confirms that the 'docker logout' command and resp. log output are misleading, because the command is in fact always executed after the selected Docker task action (like 'push' in your case, see 3), but always logged before that action's log due to the way the code is architected (addressing this log usability flaw would be for Atlassian to implement accordingly).
  2. Your Docker push fails because it is not properly authenticated, which yields this output (see 3 for a successful push):
    Not logged in to truncated.registry.tld
    I 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
  3. However, a successful push yields the following output instead (i.e. 'docker logout' is still executed):
    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:

Cause

[...]

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.

Solution

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.

kurbar July 9, 2019

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events