From 3e392505a860eb6f99b303932038ccdcdd8951c1 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Thu, 13 Jul 2017 09:03:52 -0600 Subject: [PATCH] docs: add --password-stdin also add an example of usage Signed-off-by: Tycho Andersen --- docs/reference/commandline/login.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/reference/commandline/login.md b/docs/reference/commandline/login.md index 0b8e697281..df3c5e8ea9 100644 --- a/docs/reference/commandline/login.md +++ b/docs/reference/commandline/login.md @@ -22,9 +22,10 @@ Log in to a Docker registry. If no server is specified, the default is defined by the daemon. Options: - --help Print usage - -p, --password string Password - -u, --username string Username + --help Print usage + -p, --password string Password + --password-stdin Read password from stdin + -u, --username string Username ``` ## Description @@ -40,6 +41,20 @@ adding the server name. $ docker login localhost:8080 ``` +### 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. + +The following example reads a password from a file, and passes it to the +`docker login` command using `STDIN`: + +```bash +$ cat ~/my_password.txt | docker login --username foo --password-stdin +``` + ### Privileged user requirement `docker login` requires user to use `sudo` or be `root`, except when: