github.com/sld880311/docker@v0.0.0-20200524143708-d5593973a475/docs/reference/commandline/stack_services.md (about)

     1  ---
     2  title: "stack services"
     3  description: "The stack services command description and usage"
     4  keywords: "stack, services"
     5  advisory: "experimental"
     6  ---
     7  
     8  <!-- This file is maintained within the docker/docker Github
     9       repository at https://github.com/docker/docker/. Make all
    10       pull requests against that repo. If you see this file in
    11       another repository, consider it read-only there, as it will
    12       periodically be overwritten by the definitive file. Pull
    13       requests which include edits to this file in other repositories
    14       will be rejected.
    15  -->
    16  
    17  # stack services (experimental)
    18  
    19  ```markdown
    20  Usage:	docker stack services [OPTIONS] STACK
    21  
    22  List the services in the stack
    23  
    24  Options:
    25    -f, --filter value   Filter output based on conditions provided
    26        --help           Print usage
    27    -q, --quiet          Only display IDs
    28  ```
    29  
    30  ## Description
    31  
    32  Lists the services that are running as part of the specified stack. This
    33  command has to be run targeting a manager node.
    34  
    35  ## Examples
    36  
    37  The following command shows all services in the `myapp` stack:
    38  
    39  ```bash
    40  $ docker stack services myapp
    41  
    42  ID            NAME            REPLICAS  IMAGE                                                                          COMMAND
    43  7be5ei6sqeye  myapp_web       1/1       nginx@sha256:23f809e7fd5952e7d5be065b4d3643fbbceccd349d537b62a123ef2201bc886f
    44  dn7m7nhhfb9y  myapp_db        1/1       mysql@sha256:a9a5b559f8821fe73d58c3606c812d1c044868d42c63817fa5125fd9d8b7b539
    45  ```
    46  
    47  ### Filtering
    48  
    49  The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there
    50  is more than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`).
    51  Multiple filter flags are combined as an `OR` filter.
    52  
    53  The following command shows both the `web` and `db` services:
    54  
    55  ```bash
    56  $ docker stack services --filter name=myapp_web --filter name=myapp_db myapp
    57  
    58  ID            NAME            REPLICAS  IMAGE                                                                          COMMAND
    59  7be5ei6sqeye  myapp_web       1/1       nginx@sha256:23f809e7fd5952e7d5be065b4d3643fbbceccd349d537b62a123ef2201bc886f
    60  dn7m7nhhfb9y  myapp_db        1/1       mysql@sha256:a9a5b559f8821fe73d58c3606c812d1c044868d42c63817fa5125fd9d8b7b539
    61  ```
    62  
    63  The currently supported filters are:
    64  
    65  * id / ID (`--filter id=7be5ei6sqeye`, or `--filter ID=7be5ei6sqeye`)
    66  * name (`--filter name=myapp_web`)
    67  * label (`--filter label=key=value`)
    68  
    69  ## Related commands
    70  
    71  * [stack deploy](stack_deploy.md)
    72  * [stack ls](stack_ls.md)
    73  * [stack ps](stack_ps.md)
    74  * [stack rm](stack_rm.md)