I have this error when I login during a CI process:
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Should I just replace "--password" with "--password-stdin'?
I have this error when I login during a CI process:
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Should I just replace "--password" with "--password-stdin'?
According to docker documentation:
The following examples read a password from a file, and passes it to the docker login command using STDIN:
or
The following example reads a password from a variable, and passes it to the docker login command using STDIN:
This is a warning one commonly gets using AWS. If this is the case, another solution to the problem could be not explicitly running the command so that it gets stored in the history. To do this, one could use (with aws2)
Even though you will still see the warning, the explicit docker command containing the key/password is not stored in the bash history. If unconvinced, try running the
history
command to see for yourself.The same
echo
command on a Windows based system (or when running in an Azure Pipelines task based on vs2017-win2016) does also output an additional newline.A workaround for this to use
set /p
, see also question + answer.The full command will be like:
echo | set /p="my_password" | docker login --username foo --password-stdin