Unable to docker push with Bamboo as the docker login command fails with exit code: 125 due to --password-stdin being an unknown flag

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Unable to docker push with Bamboo as the docker login command fails with exit code: 125. Example:

1 2 3 Caused by: com.atlassian.utils.process.ProcessException: Error executing '/usr/bin/docker login -u bamboo --password-stdin docker-registry.com:5002', exit code: 125 at com.atlassian.bamboo.plugins.docker.process.DefaultDockerProcessService.execute(DefaultDockerProcessService.java:66) at com.atlassian.bamboo.plugins.docker.process.DefaultDockerProcessService.executeSilently(DefaultDockerProcessService.java:76)

Environment

  • Docker version < 17.07 (e.g. Docker 1.13) installed on the agent performing the build

  • Bamboo 6.9.0 or more recent

Diagnosis

Running the below commands in a terminal on the agent server can help validate the presence of the issue:

Running the same command that Bamboo uses:

1 2 3 $ /usr/bin/docker login -u bamboo --password-stdin docker-registry.com:5002 .. > `unknown flag: --password-stdin`

Verifying the docker version:

1 2 $ docker --version Docker version 1.13.1, build 64e9980/1.13.1

Cause

  • Versions of docker before 17.07 do not support the argument --password-stdin

  • Bamboo 6.9.0 and more recent only support Docker 17.07: Bamboo 6.9 - Supported Platforms

Solution

Solution #1

Upgrade Docker to a supported version on your Bamboo agents. At time of writing, this is Docker 17.07.

Solution #2

Switch the authentication type on the Docker task in Bamboo to Use the agent's native credentials and ensure that docker login has been performed manually on each agent as the same user that runs the agent (this will cause the credentials be stored, base64 encoded in $HOME/.docker/config.json for the user running the agent). You may also choose to configure a credential store as described in the docker login documentation:

Solution #3

Convert your Docker push task into a Bamboo Script task and manually write the command using a syntax (--password instead of --password-stdin) that is compatible with your Docker version. Example:

1 2 /usr/bin/docker login -u bamboo --password ${bamboo.dockerPassword} docker-registry.com:5002 /usr/bin/docker push [OPTIONS] NAME[:TAG]
  • Be sure to define a dockerPassword variable in your build variables to use here.

Updated on March 7, 2025

Still need help?

The Atlassian Community is here for you.