Docker login not working with ENV variables



When you use the ENV variables for your docker username or password, the docker login command fails. When you use the same exact values in clear text for username and password it works fine.

You can see the build example here where I used clear text and it worked. Go to the final build step section “Build and Push Order Service Docker Image”.

and this build here I simply switched out the password for $DOCKER_PASS (which had the same password except in an environment variable) and it failed with:

flag needs an argument: 'p' in -p
See 'docker login --help'.
Exited with code 125



This looks to be because you are trying to build a pull request (PR) but you have the settings for build secrets, such as environment variables set via the UI, to not be passed to PRs. Thus when you run this build, the value for $DOCKER_PASS should be empty.

More specifically, this is a forked PR and not a PR from within the same org/repo. So if you did a PR from a branch within the upstream org or after you merge your forked PR, it should work.


Thanks for this information! I now see the “Pass secrets to builds from forked pull requests” in the advanced settings. In general, it would be great to have documentation to understand proper scope of ENV vars. More specifically in either or both of these locations:

  1. ENV Variables Docs page:
  2. Build Settings - Environment Variables (within each build) i.e.

For #1 I could to contribute a PR to update the documents - if you’re open to it. For #2 I of course have no ability to update the default text listed there, but at a minimum you could link to #1 :).


That sounds great.

Both our docs and the build interface are actually open-source:

The frontend takes a bit to setup though.