Bamboo Docker task fails due to ProcessException: Error executing '/usr/bin/docker login ...', exit code: 125

Problem

Your builds fail when pushing images to Amazon ECR encountering a ProcessException: Error executing '/usr/bin/docker login -u AWS -p ******** -e ******** 712484210124.dkr.ecr.eu-west-1.amazonaws.com', exit code: 125:

1 2 3 4 5 6 7 8 9 10 11 12 build 20-Jul-2018 12:53:07 Not logged in to 712484210124.dkr.ecr.eu-west-1.amazonaws.com error 20-Jul-2018 12:53:07 Error occurred while running Task 'Push image to ECR(3)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli. error 20-Jul-2018 12:53:07 com.atlassian.bamboo.task.TaskException: Failed to execute task error 20-Jul-2018 12:53:07 at com.atlassian.bamboo.plugins.docker.service.PushService.execute(PushService.java:41) [...] error 20-Jul-2018 12:53:07 Caused by: com.atlassian.bamboo.docker.DockerException: Error running Docker push command. See messages above for details. error 20-Jul-2018 12:53:07 at com.atlassian.bamboo.plugins.docker.client.DockerCmd.push(DockerCmd.java:157) error 20-Jul-2018 12:53:07 at com.atlassian.bamboo.plugins.docker.service.PushService.execute(PushService.java:37) error 20-Jul-2018 12:53:07 ... 17 more error 20-Jul-2018 12:53:07 Caused by: com.atlassian.utils.process.ProcessException: Error executing '/usr/bin/docker login -u AWS -p ******** -e ******** 712484210124.dkr.ecr.eu-west-1.amazonaws.com', exit code: 125

Cause

You are probably using Utoolity's ECR Credentials task together with Atlassian's built-in Docker task, as outlined in How to push a Docker image to a repository in your Amazon ECR registry with the Bamboo Docker task.

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.

Workarounds

If you cannot upgrade your Bamboo version right away, you might be able to apply one of the following workarounds:

  1. Upgrade only the Bamboo Docker app itself to release 6.2.0, as suggested by Atlassian's Alexey Chystoprudov in his answer to Bamboo Docker Push fails
    Please note that Alexey emphasizes that they cannot guarantee it is 100% compatible!

  2. Temporarily replace the dedicated Docker task by specifying the desired docker login command line without the --email flag from a Script task instead.
    You can inject the ECR credentials in a similar fashion as outlined for the regular AWS credentials in How to work around limitations with the AWS Command Line Interface (AWS CLI).