github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/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  # stack ls
     8  
     9  ```markdown
    10  Usage:  docker stack ls [OPTIONS]
    11  
    12  List stacks
    13  
    14  Aliases:
    15    ls, list
    16  
    17  Options:
    18        --help                  Print usage
    19        --format string         Pretty-print stacks using a Go template
    20        --kubeconfig string     Kubernetes config file
    21        --namespace string      Kubernetes namespace to use
    22        --orchestrator string   Orchestrator to use (swarm|kubernetes|all)
    23  ```
    24  
    25  ## Description
    26  
    27  Lists the stacks.
    28  
    29  > **Note**
    30  >
    31  > This is a cluster management command, and must be executed on a swarm
    32  > manager node. To learn about managers and workers, refer to the
    33  > [Swarm mode section](https://docs.docker.com/engine/swarm/) in the
    34  > documentation.
    35  
    36  ## Examples
    37  
    38  The following command shows all stacks and some additional information:
    39  
    40  ```bash
    41  $ docker stack ls
    42  
    43  ID                 SERVICES            ORCHESTRATOR
    44  myapp              2                   Kubernetes
    45  vossibility-stack  6                   Swarm
    46  ```
    47  
    48  ### Formatting
    49  
    50  The formatting option (`--format`) pretty-prints stacks using a Go template.
    51  
    52  Valid placeholders for the Go template are listed below:
    53  
    54  | Placeholder     | Description        |
    55  | --------------- | ------------------ |
    56  | `.Name`         | Stack name         |
    57  | `.Services`     | Number of services |
    58  | `.Orchestrator` | Orchestrator name  |
    59  | `.Namespace`    | Namespace          |
    60  
    61  When using the `--format` option, the `stack ls` command either outputs
    62  the data exactly as the template declares or, when using the
    63  `table` directive, includes column headers as well.
    64  
    65  The following example uses a template without headers and outputs the
    66  `Name` and `Services` entries separated by a colon (`:`) for all stacks:
    67  
    68  ```bash
    69  $ docker stack ls --format "{{.Name}}: {{.Services}}"
    70  web-server: 1
    71  web-cache: 4
    72  ```
    73  
    74  ## Related commands
    75  
    76  * [stack deploy](stack_deploy.md)
    77  * [stack ps](stack_ps.md)
    78  * [stack rm](stack_rm.md)
    79  * [stack services](stack_services.md)