mirror of https://github.com/docker/cli.git
bbb6e7643d
Running `docker login` in a non-interactive environment sometimes errors out if no username/pwd is provided. This handling is somewhat inconsistent – this commit addresses that. Before: | `--username` | `--password` | Result | |:------------:|:------------:| ------------------------------------------------------------------ | | ✅ | ✅ | ✅ | | ❌ | ❌ | `Error: Cannot perform an interactive login from a non TTY device` | | ✅ | ❌ | `Error: Cannot perform an interactive login from a non TTY device` | | ❌ | ✅ | hangs | After: | `--username` | `--password` | Result | |:------------:|:------------:| ------------------------------------------------------------------ | | ✅ | ✅ | ✅ | | ❌ | ❌ | `Error: Cannot perform an interactive login from a non TTY device` | | ✅ | ❌ | `Error: Cannot perform an interactive login from a non TTY device` | | ❌ | ✅ | `Error: Cannot perform an interactive login from a non TTY device` | It's worth calling out a separate scenario – if there are previous, valid credentials, then running `docker login` with no username or password provided will use the previously stored credentials, and not error out. ```console cat ~/.docker/config.json { "auths": { "https://index.docker.io/v1/": { "auth": "xxxxxxxxxxx" } } } ⭑ docker login 0>/dev/null Authenticating with existing credentials... Login Succeeded ``` This commit also applies the same non-interactive handling logic to the new web-based login flow, which means that now, if there are no prior credentials stored and a user runs `docker login`, instead of initiating the new web-based login flow, an error is returned. Signed-off-by: Laura Brehm <laurabrehm@hey.com> |
||
---|---|---|
.. | ||
builder | ||
checkpoint | ||
commands | ||
completion | ||
config | ||
container | ||
context | ||
formatter | ||
idresolver | ||
image | ||
inspect | ||
manifest | ||
network | ||
node | ||
plugin | ||
registry | ||
secret | ||
service | ||
stack | ||
swarm | ||
system | ||
task | ||
testdata | ||
trust | ||
volume | ||
cli.go | ||
cli_options.go | ||
cli_options_test.go | ||
cli_test.go | ||
context.go | ||
context_test.go | ||
defaultcontextstore.go | ||
defaultcontextstore_test.go | ||
registry.go | ||
registry_test.go | ||
telemetry.go | ||
telemetry_docker.go | ||
telemetry_options.go | ||
telemetry_utils.go | ||
telemetry_utils_test.go | ||
trust.go | ||
utils.go | ||
utils_test.go |