Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: Using --password via the CLI is insecure. Use --password-stdin

I have the following warning when I log in to my registry during a continuous integration (CI) process:

WARNING! Using --password via the CLI is insecure. Use --password-stdin. 

Should I just replace --password with --password-stdin?

like image 639
Dimitri Kopriwa Avatar asked Jul 24 '18 01:07

Dimitri Kopriwa


People also ask

What is password Stdin?

Provide a password using STDIN To run the docker login command non-interactively, you can set the --password-stdin flag to provide a password through STDIN . Using STDIN prevents the password from ending up in the shell's history, or log-files.

How do I find my docker username and password?

If you are looking for your Docker username and password, you can use the “docker login” command to find them. Go to the Docker ID password reset page, input the email address connected with your Docker ID, then click Reset password to restore your Docker ID username and/or password.


1 Answers

According to docker documentation:

To run the docker login command non-interactively, you can set the --password-stdin flag to provide a password through STDIN. Using STDIN prevents the password from ending up in the shell’s history, or log-files.

The following examples read a password from a file, and passes it to the docker login command using STDIN:

$ cat ~/my_password.txt | docker login --username foo --password-stdin 

or

$ docker login --username foo --password-stdin < ~/my_password 

The following example reads a password from a variable, and passes it to the docker login command using STDIN:

$ echo "$MY_PASSWORD" | docker login --username foo --password-stdin 
like image 145
nickgryg Avatar answered Sep 20 '22 17:09

nickgryg