Merge component 'cli' from git@github.com:docker/cli master

This commit is contained in:
GordonTheTurtle
2018-04-18 16:41:26 +00:00
3 changed files with 24 additions and 19 deletions
+9 -16
View File
@@ -55,22 +55,15 @@ func NewLoginCommand(dockerCli command.Cli) *cobra.Command {
return cmd
}
// unencryptedPrompt prompts the user to find out whether they want to continue
// with insecure credential storage. If stdin is not a terminal, we assume they
// want it (sadly), because people may have been scripting insecure logins and
// we don't want to break them. Maybe they'll see the warning in their logs and
// fix things.
func unencryptedPrompt(dockerCli command.Streams, filename string) error {
fmt.Fprintln(dockerCli.Err(), fmt.Sprintf(unencryptedWarning, filename))
// displayUnencryptedWarning warns the user when using an insecure credential storage.
// After a deprecation period, user will get prompted if stdin and stderr are a terminal.
// Otherwise, we'll assume they want it (sadly), because people may have been scripting
// insecure logins and we don't want to break them. Maybe they'll see the warning in their
// logs and fix things.
func displayUnencryptedWarning(dockerCli command.Streams, filename string) error {
_, err := fmt.Fprintln(dockerCli.Err(), fmt.Sprintf(unencryptedWarning, filename))
if dockerCli.In().IsTerminal() {
if command.PromptForConfirmation(dockerCli.In(), dockerCli.Out(), "") {
return nil
}
return errors.Errorf("User refused unencrypted credentials storage.")
}
return nil
return err
}
type isFileStore interface {
@@ -146,7 +139,7 @@ func runLogin(dockerCli command.Cli, opts loginOptions) error { //nolint: gocycl
store, isDefault := creds.(isFileStore)
if isDefault {
err = unencryptedPrompt(dockerCli, store.GetFilename())
err = displayUnencryptedWarning(dockerCli, store.GetFilename())
if err != nil {
return err
}
@@ -425,6 +425,18 @@ Dockerfile are echoed during the build process.
For detailed information on using `ARG` and `ENV` instructions, see the
[Dockerfile reference](../builder.md).
You may also use the `--build-arg` flag without a value, in which case the value
from the local environment will be propagated into the Docker container being
built:
```bash
$ export HTTP_PROXY=http://10.20.30.2:1234
$ docker build --build-arg HTTP_PROXY .
```
This is similar to how `docker run -e` works. Refer to the [`docker run` documentation](https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file)
for more information.
### Optional security options (--security-opt)
This flag is only supported on a daemon running on Windows, and only supports
@@ -504,7 +516,7 @@ section in the userguide for more information.
The `--squash` option has a number of known limitations:
- When squashing layers, the resulting image cannot take advantage of layer
- When squashing layers, the resulting image cannot take advantage of layer
sharing with other images, and may use significantly more space. Sharing the
base image is still supported.
- When using this option you may see significantly more space used due to
@@ -581,7 +593,7 @@ $ docker build --squash -t test .
If everything is right, the history will look like this:
```bash
$ docker history test
$ docker history test
IMAGE CREATED CREATED BY SIZE COMMENT
4e10cb5b4cac 3 seconds ago 12 B merge sha256:88a7b0112a41826885df0e7072698006ee8f621c6ab99fca7fe9151d7b599702 to sha256:47bcc53f74dc94b1920f0b34f6036096526296767650f223433fe65c35f149eb
@@ -35,7 +35,7 @@ bzip2, or xz) from a file or STDIN. It restores both images and tags.
## Examples
```bash
$ docker docker image ls
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE