Merge pull request #332 from tych0/docs-fixups-for-password-stdin

Docs fixups for password stdin
This commit is contained in:
Vincent Demeester 2017-07-20 11:31:23 +02:00 committed by GitHub
commit 3d76febd17
4 changed files with 21 additions and 4 deletions

View File

@ -2851,7 +2851,7 @@ _docker_login() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help --password -p --username -u" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help --password --password-stdin -p --username -u" -- "$cur" ) )
;;
esac
}

View File

@ -229,6 +229,7 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from load' -s i -l input -d
complete -c docker -f -n '__fish_docker_no_subcommand' -a login -d 'Log in to a Docker registry server'
complete -c docker -A -f -n '__fish_seen_subcommand_from login' -l help -d 'Print usage'
complete -c docker -A -f -n '__fish_seen_subcommand_from login' -s p -l password -d 'Password'
complete -c docker -A -f -n '__fish_seen_subcommand_from login' -l password-stdin -d 'Read password from stdin'
complete -c docker -A -f -n '__fish_seen_subcommand_from login' -s u -l username -d 'Username'
# logout

View File

@ -2761,6 +2761,7 @@ __docker_subcommand() {
_arguments $(__docker_arguments) -A '-*' \
$opts_help \
"($help -p --password)"{-p=,--password=}"[Password]:password: " \
"($help)--password-stdin[Read password from stdin]" \
"($help -u --user)"{-u=,--user=}"[Username]:username: " \
"($help -)1:server: " && ret=0
;;

View File

@ -24,6 +24,7 @@ If no server is specified, the default is defined by the daemon.
Options:
--help Print usage
-p, --password string Password
--password-stdin Read password from stdin
-u, --username string Username
```
@ -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: