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

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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:

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:

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

Verifying the docker version:

$ 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:

/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.


Last modified on May 20, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.