diff --git a/cli/cobra.go b/cli/cobra.go index 1b5809e9e5..03cdfcc573 100644 --- a/cli/cobra.go +++ b/cli/cobra.go @@ -102,7 +102,7 @@ func managementSubCommands(cmd *cobra.Command) []*cobra.Command { var usageTemplate = `Usage: {{- if not .HasSubCommands}} {{.UseLine}}{{end}} -{{- if .HasSubCommands}} {{ .CommandPath}} COMMAND{{end}} +{{- if .HasSubCommands}} {{ .CommandPath}}{{- if .HasAvailableFlags}} [OPTIONS]{{end}} COMMAND{{end}} {{ .Short | trim }} diff --git a/cli/command/stack/cmd.go b/cli/command/stack/cmd.go index 5de3743021..c9feb99b61 100644 --- a/cli/command/stack/cmd.go +++ b/cli/command/stack/cmd.go @@ -23,7 +23,7 @@ type commonOptions struct { func NewStackCommand(dockerCli command.Cli) *cobra.Command { var opts commonOptions cmd := &cobra.Command{ - Use: "stack", + Use: "stack [OPTIONS]", Short: "Manage Docker stacks", Args: cli.NoArgs, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { diff --git a/cli/command/stack/list.go b/cli/command/stack/list.go index 11e69f5027..a0aa3d1cf5 100644 --- a/cli/command/stack/list.go +++ b/cli/command/stack/list.go @@ -17,7 +17,7 @@ func newListCommand(dockerCli command.Cli, common *commonOptions) *cobra.Command opts := options.List{} cmd := &cobra.Command{ - Use: "ls", + Use: "ls [OPTIONS]", Aliases: []string{"list"}, Short: "List stacks", Args: cli.NoArgs, diff --git a/cli/command/stack/remove.go b/cli/command/stack/remove.go index c139a296dd..8738e6eafa 100644 --- a/cli/command/stack/remove.go +++ b/cli/command/stack/remove.go @@ -13,7 +13,7 @@ func newRemoveCommand(dockerCli command.Cli, common *commonOptions) *cobra.Comma var opts options.Remove cmd := &cobra.Command{ - Use: "rm STACK [STACK...]", + Use: "rm [OPTIONS] STACK [STACK...]", Aliases: []string{"remove", "down"}, Short: "Remove one or more stacks", Args: cli.RequiresMinArgs(1), diff --git a/docs/reference/commandline/cli.md b/docs/reference/commandline/cli.md index ebb9faae27..81cd64f28b 100644 --- a/docs/reference/commandline/cli.md +++ b/docs/reference/commandline/cli.md @@ -66,6 +66,7 @@ by the `docker` command line: * `DOCKER_NOWARN_KERNEL_VERSION` Prevent warnings that your Linux kernel is unsuitable for Docker. * `DOCKER_RAMDISK` If set this will disable 'pivot_root'. +* `DOCKER_STACK_ORCHESTRATOR` Configure the default orchestrator to use when using `docker stack` management commands. * `DOCKER_TLS` When set Docker uses TLS. * `DOCKER_TLS_VERIFY` When set Docker uses TLS and verifies the remote. * `DOCKER_CONTENT_TRUST` When set Docker uses notary to sign and verify images. @@ -196,6 +197,11 @@ credentials for specific registries. If this property is set, the binary for a specific registry. For more information, see the [**Credential helpers** section in the `docker login` documentation](login.md#credential-helpers) +The property `stackOrchestrator` specifies the default orchestrator to use when +running `docker stack` management commands. Valid values are `"swarm"`, +`"kubernetes"`, and `"all"`. This property can be overridden with the +`DOCKER_STACK_ORCHESTRATOR` environment variable, or the `--orchestrator` flag. + Once attached to a container, users detach from it and leave it running using the using `CTRL-p CTRL-q` key sequence. This detach key sequence is customizable using the `detachKeys` property. Specify a `` value for the @@ -236,7 +242,8 @@ Following is a sample `config.json` file: "credHelpers": { "awesomereg.example.org": "hip-star", "unicorn.example.com": "vcbait" - } + }, + "stackOrchestrator": "kubernetes" } {% endraw %} ``` diff --git a/docs/reference/commandline/stack.md b/docs/reference/commandline/stack.md index 428df82f29..cdb5f3ff84 100644 --- a/docs/reference/commandline/stack.md +++ b/docs/reference/commandline/stack.md @@ -16,18 +16,20 @@ keywords: "stack" # stack ```markdown -Usage: docker stack COMMAND +Usage: docker stack [OPTIONS] COMMAND Manage Docker stacks Options: - --help Print usage + --help Print usage + --kubeconfig string Kubernetes config file + --orchestrator string Orchestrator to use (swarm|kubernetes|all) Commands: deploy Deploy a new stack or update an existing stack ls List stacks ps List the tasks in the stack - rm Remove the stack + rm Remove one or more stacks services List the services in the stack Run 'docker stack COMMAND --help' for more information on a command. diff --git a/docs/reference/commandline/stack_deploy.md b/docs/reference/commandline/stack_deploy.md index 2adbc64e9e..8f7687bce8 100644 --- a/docs/reference/commandline/stack_deploy.md +++ b/docs/reference/commandline/stack_deploy.md @@ -27,6 +27,9 @@ Options: --bundle-file string Path to a Distributed Application Bundle file -c, --compose-file strings Path to a Compose file --help Print usage + --kubeconfig string Kubernetes config file + --namespace string Kubernetes namespace to use + --orchestrator string Orchestrator to use (swarm|kubernetes|all) --prune Prune services that are no longer referenced --resolve-image string Query the registry to resolve image digest and supported platforms ("always"|"changed"|"never") (default "always") diff --git a/docs/reference/commandline/stack_ls.md b/docs/reference/commandline/stack_ls.md index 6613577e64..dd0857ebc9 100644 --- a/docs/reference/commandline/stack_ls.md +++ b/docs/reference/commandline/stack_ls.md @@ -16,7 +16,7 @@ keywords: "stack, ls" # stack ls ```markdown -Usage: docker stack ls +Usage: docker stack ls [OPTIONS] List stacks @@ -24,8 +24,11 @@ Aliases: ls, list Options: - --help Print usage - --format string Pretty-print stacks using a Go template + --help Print usage + --format string Pretty-print stacks using a Go template + --kubeconfig string Kubernetes config file + --namespace string Kubernetes namespace to use + --orchestrator string Orchestrator to use (swarm|kubernetes|all) ``` ## Description diff --git a/docs/reference/commandline/stack_ps.md b/docs/reference/commandline/stack_ps.md index bcdacee044..bf25c722b2 100644 --- a/docs/reference/commandline/stack_ps.md +++ b/docs/reference/commandline/stack_ps.md @@ -21,12 +21,15 @@ Usage: docker stack ps [OPTIONS] STACK List the tasks in the stack Options: - -f, --filter filter Filter output based on conditions provided - --format string Pretty-print tasks using a Go template - --help Print usage - --no-resolve Do not map IDs to Names - --no-trunc Do not truncate output - -q, --quiet Only display task IDs + -f, --filter filter Filter output based on conditions provided + --format string Pretty-print tasks using a Go template + --help Print usage + --kubeconfig string Kubernetes config file + --namespace string Kubernetes namespace to use + --no-resolve Do not map IDs to Names + --no-trunc Do not truncate output + --orchestrator string Orchestrator to use (swarm|kubernetes|all) + -q, --quiet Only display task IDs ``` ## Description diff --git a/docs/reference/commandline/stack_rm.md b/docs/reference/commandline/stack_rm.md index e51037c090..b9d48a345a 100644 --- a/docs/reference/commandline/stack_rm.md +++ b/docs/reference/commandline/stack_rm.md @@ -16,7 +16,7 @@ keywords: "stack, rm, remove, down" # stack rm ```markdown -Usage: docker stack rm STACK [STACK...] +Usage: docker stack rm [OPTIONS] STACK [STACK...] Remove one or more stacks @@ -24,7 +24,10 @@ Aliases: rm, remove, down Options: - --help Print usage + --help Print usage + --kubeconfig string Kubernetes config file + --namespace string Kubernetes namespace to use + --orchestrator string Orchestrator to use (swarm|kubernetes|all) ``` ## Description diff --git a/docs/reference/commandline/stack_services.md b/docs/reference/commandline/stack_services.md index 5cb3c110b6..2f60df4267 100644 --- a/docs/reference/commandline/stack_services.md +++ b/docs/reference/commandline/stack_services.md @@ -2,7 +2,6 @@ title: "stack services" description: "The stack services command description and usage" keywords: "stack, services" -advisory: "experimental" --- -# stack services (experimental) +# stack services ```markdown Usage: docker stack services [OPTIONS] STACK @@ -22,10 +21,13 @@ Usage: docker stack services [OPTIONS] STACK List the services in the stack Options: - -f, --filter filter Filter output based on conditions provided - --format string Pretty-print services using a Go template - --help Print usage - -q, --quiet Only display IDs + -f, --filter filter Filter output based on conditions provided + --format string Pretty-print services using a Go template + --help Print usage + --kubeconfig string Kubernetes config file + --namespace string Kubernetes namespace to use + --orchestrator string Orchestrator to use (swarm|kubernetes|all) + -q, --quiet Only display IDs ``` ## Description diff --git a/docs/reference/commandline/version.md b/docs/reference/commandline/version.md index aa720fa583..db76221887 100644 --- a/docs/reference/commandline/version.md +++ b/docs/reference/commandline/version.md @@ -21,8 +21,9 @@ Usage: docker version [OPTIONS] Show the Docker version information Options: - -f, --format string Format the output using the given Go template - --help Print usage + -f, --format string Format the output using the given Go template + --help Print usage + -k, --kubeconfig string Kubernetes config file ``` ## Description