From e2458dab76a69a22a98d9da5e50fb94a8b388417 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 21 Mar 2018 19:00:11 +0100 Subject: [PATCH 1/3] Docs touch-ups for "autoremove" and broken anchor `--rm` moved to the daemon, so is now also supported when combined with `-d`. Signed-off-by: Sebastiaan van Stijn Upstream-commit: e9ce688d6e6d990794b51fac5ed2fed619c89f4f Component: cli --- components/cli/docs/reference/commandline/run.md | 4 ++-- components/cli/docs/reference/run.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/cli/docs/reference/commandline/run.md b/components/cli/docs/reference/commandline/run.md index da5254475e..71d6c6348b 100644 --- a/components/cli/docs/reference/commandline/run.md +++ b/components/cli/docs/reference/commandline/run.md @@ -592,7 +592,7 @@ Docker supports the following restart policies: |:---------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `no` | Do not automatically restart the container when it exits. This is the default. | | `on-failure[:max-retries]` | Restart only if the container exits with a non-zero exit status. Optionally, limit the number of restart retries the Docker daemon attempts. | -| `unless-stopped` | Restart the container unless it is explicitly stopped or Docker itself is stopped or restarted. | +| `unless-stopped` | Restart the container unless it is explicitly stopped or Docker itself is stopped or restarted. | | `always` | Always restart the container regardless of the exit status. When you specify always, the Docker daemon will try to restart the container indefinitely. The container will also always start on daemon startup, regardless of the current state of the container. | ```bash @@ -603,7 +603,7 @@ This will run the `redis` container with a restart policy of **always** so that if the container exits, Docker will restart it. More detailed information on restart policies can be found in the -[Restart Policies (--restart)](../run.md#restart-policies-restart) +[Restart Policies (--restart)](../run.md#restart-policies---restart) section of the Docker run reference page. ### Add entries to container hosts file (--add-host) diff --git a/components/cli/docs/reference/run.md b/components/cli/docs/reference/run.md index b65504b62b..5c393d60cf 100644 --- a/components/cli/docs/reference/run.md +++ b/components/cli/docs/reference/run.md @@ -620,7 +620,7 @@ systems can really pile up. If instead you'd like Docker to **automatically clean up the container and remove the file system when the container exits**, you can add the `--rm` flag: - --rm=false: Automatically remove the container when it exits (incompatible with -d) + --rm=false: Automatically remove the container when it exits > **Note**: When you set the `--rm` flag, Docker also removes the anonymous volumes associated with the container when the container is removed. This is similar From 4758c92085bd3786851ad767671118abed02d48c Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Thu, 22 Mar 2018 15:13:04 +0100 Subject: [PATCH 2/3] Use HasAvailableFlags instead of HasFlags for Options in help > HasAvailableFlags checks if the command contains any flags (local > plus persistent from the entire structure) which are not hidden or > deprecated. This fix the `--help` display when the `Options` is empty (but showing), like on `docker trust key` Signed-off-by: Vincent Demeester Upstream-commit: 66fdd085a51f2725a8b58c0203f0a544a169950c Component: cli --- components/cli/cli/cobra.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/cli/cli/cobra.go b/components/cli/cli/cobra.go index 3a5691a8c3..e97abd2a1b 100644 --- a/components/cli/cli/cobra.go +++ b/components/cli/cli/cobra.go @@ -128,7 +128,7 @@ Examples: {{ .Example }} {{- end}} -{{- if .HasFlags}} +{{- if .HasAvailableFlags}} Options: {{ wrappedFlagUsages . | trimRightSpace}} From 86110646cce189c931b181b554a1a97a3589e649 Mon Sep 17 00:00:00 2001 From: Silvin Lubecki Date: Tue, 20 Mar 2018 16:42:57 +0100 Subject: [PATCH 3/3] Fix Kubernetes duplication in version command when the server already exposes one Kubernetes component Signed-off-by: Silvin Lubecki Upstream-commit: 54bb5ffeca9eb2fa5c3523330d7b9c9ca99dc4cd Component: cli --- components/cli/cli/command/system/version.go | 37 +++++++++++--------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/components/cli/cli/command/system/version.go b/components/cli/cli/command/system/version.go index 20995dc38a..ac53ec62f2 100644 --- a/components/cli/cli/command/system/version.go +++ b/components/cli/cli/command/system/version.go @@ -51,12 +51,7 @@ Server:{{if ne .Platform.Name ""}} {{.Platform.Name}}{{end}} {{- end}} {{- end}} {{- end}} - {{- end}}{{- end}} - {{- if .KubernetesOK}}{{with .Kubernetes}} - Kubernetes: - Version: {{.Kubernetes}} - Stack API: {{.StackAPI}} -{{- end}}{{end}}` + {{- end}}{{- end}}` type versionOptions struct { format string @@ -65,9 +60,8 @@ type versionOptions struct { // versionInfo contains version information of both the Client, and Server type versionInfo struct { - Client clientVersion - Server *types.Version - Kubernetes *kubernetesVersion + Client clientVersion + Server *types.Version } type clientVersion struct { @@ -96,10 +90,6 @@ func (v versionInfo) ServerOK() bool { return v.Server != nil } -func (v versionInfo) KubernetesOK() bool { - return v.Kubernetes != nil -} - // NewVersionCommand creates a new cobra.Command for `docker version` func NewVersionCommand(dockerCli command.Cli) *cobra.Command { var opts versionOptions @@ -160,21 +150,27 @@ func runVersion(dockerCli command.Cli, opts *versionOptions) error { Experimental: dockerCli.ClientInfo().HasExperimental, Orchestrator: string(dockerCli.ClientInfo().Orchestrator), }, - Kubernetes: getKubernetesVersion(dockerCli, opts.kubeConfig), } sv, err := dockerCli.Client().ServerVersion(context.Background()) if err == nil { vd.Server = &sv + kubeVersion := getKubernetesVersion(dockerCli, opts.kubeConfig) foundEngine := false + foundKubernetes := false for _, component := range sv.Components { - if component.Name == "Engine" { + switch component.Name { + case "Engine": foundEngine = true buildTime, ok := component.Details["BuildTime"] if ok { component.Details["BuildTime"] = reformatDate(buildTime) } - break + case "Kubernetes": + foundKubernetes = true + if _, ok := component.Details["StackAPI"]; !ok && kubeVersion != nil { + component.Details["StackAPI"] = kubeVersion.StackAPI + } } } @@ -194,6 +190,15 @@ func runVersion(dockerCli command.Cli, opts *versionOptions) error { }, }) } + if !foundKubernetes && kubeVersion != nil { + vd.Server.Components = append(vd.Server.Components, types.ComponentVersion{ + Name: "Kubernetes", + Version: kubeVersion.Kubernetes, + Details: map[string]string{ + "StackAPI": kubeVersion.StackAPI, + }, + }) + } } if err2 := tmpl.Execute(dockerCli.Out(), vd); err2 != nil && err == nil {