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