github.com/AliyunContainerService/cli@v0.0.0-20181009023821-814ced4b30d0/docs/reference/commandline/stack_ls.md (about)

     1  ---
     2  title: "stack ls"
     3  description: "The stack ls command description and usage"
     4  keywords: "stack, ls"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/cli GitHub
     8       repository at https://github.com/docker/cli/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # stack ls
    17  
    18  ```markdown
    19  Usage:	docker stack ls [OPTIONS]
    20  
    21  List stacks
    22  
    23  Aliases:
    24    ls, list
    25  
    26  Options:
    27        --help                  Print usage
    28        --format string         Pretty-print stacks using a Go template
    29        --kubeconfig string     Kubernetes config file
    30        --namespace string      Kubernetes namespace to use
    31        --orchestrator string   Orchestrator to use (swarm|kubernetes|all)
    32  ```
    33  
    34  ## Description
    35  
    36  Lists the stacks.
    37  
    38  ## Examples
    39  
    40  The following command shows all stacks and some additional information:
    41  
    42  ```bash
    43  $ docker stack ls
    44  
    45  ID                 SERVICES            ORCHESTRATOR
    46  myapp              2                   Kubernetes
    47  vossibility-stack  6                   Swarm
    48  ```
    49  
    50  ### Formatting
    51  
    52  The formatting option (`--format`) pretty-prints stacks using a Go template.
    53  
    54  Valid placeholders for the Go template are listed below:
    55  
    56  | Placeholder     | Description        |
    57  | --------------- | ------------------ |
    58  | `.Name`         | Stack name         |
    59  | `.Services`     | Number of services |
    60  | `.Orchestrator` | Orchestrator name  |
    61  | `.Namespace`    | Namespace          |
    62  
    63  When using the `--format` option, the `stack ls` command either outputs
    64  the data exactly as the template declares or, when using the
    65  `table` directive, includes column headers as well.
    66  
    67  The following example uses a template without headers and outputs the
    68  `Name` and `Services` entries separated by a colon for all stacks:
    69  
    70  ```bash
    71  $ docker stack ls --format "{{.Name}}: {{.Services}}"
    72  web-server: 1
    73  web-cache: 4
    74  ```
    75  
    76  ## Related commands
    77  
    78  * [stack deploy](stack_deploy.md)
    79  * [stack ps](stack_ps.md)
    80  * [stack rm](stack_rm.md)
    81  * [stack services](stack_services.md)