github.com/olljanat/moby@v1.13.1/docs/reference/commandline/service_ls.md (about)

     1  ---
     2  title: "service ls"
     3  description: "The service ls command description and usage"
     4  keywords: "service, ls"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. 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  # service ls
    17  
    18  ```Markdown
    19  Usage:	docker service ls [OPTIONS]
    20  
    21  List services
    22  
    23  Aliases:
    24    ls, list
    25  
    26  Options:
    27    -f, --filter value   Filter output based on conditions provided
    28        --help           Print usage
    29    -q, --quiet          Only display IDs
    30  ```
    31  
    32  This command when run targeting a manager, lists services are running in the
    33  swarm.
    34  
    35  On a manager node:
    36  ```bash
    37  $ docker service ls
    38  ID            NAME      MODE        REPLICAS    IMAGE
    39  c8wgl7q4ndfd  frontend  replicated  5/5         nginx:alpine
    40  dmu1ept4cxcf  redis     replicated  3/3         redis:3.0.6
    41  iwe3278osahj  mongo     global      7/7         mongo:3.3
    42  ```
    43  
    44  The `REPLICAS` column shows both the *actual* and *desired* number of tasks for
    45  the service.
    46  
    47  ## Filtering
    48  
    49  The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more
    50  than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
    51  
    52  The currently supported filters are:
    53  
    54  * [id](service_ls.md#id)
    55  * [label](service_ls.md#label)
    56  * [name](service_ls.md#name)
    57  
    58  #### ID
    59  
    60  The `id` filter matches all or part of a service's id.
    61  
    62  ```bash
    63  $ docker service ls -f "id=0bcjw"
    64  ID            NAME   MODE        REPLICAS  IMAGE
    65  0bcjwfh8ychr  redis  replicated  1/1       redis:3.0.6
    66  ```
    67  
    68  #### Label
    69  
    70  The `label` filter matches services based on the presence of a `label` alone or
    71  a `label` and a value.
    72  
    73  The following filter matches all services with a `project` label regardless of
    74  its value:
    75  
    76  ```bash
    77  $ docker service ls --filter label=project
    78  ID            NAME       MODE        REPLICAS  IMAGE
    79  01sl1rp6nj5u  frontend2  replicated  1/1       nginx:alpine
    80  36xvvwwauej0  frontend   replicated  5/5       nginx:alpine
    81  74nzcxxjv6fq  backend    replicated  3/3       redis:3.0.6
    82  ```
    83  
    84  The following filter matches only services with the `project` label with the
    85  `project-a` value.
    86  
    87  ```bash
    88  $ docker service ls --filter label=project=project-a
    89  ID            NAME      MODE        REPLICAS  IMAGE
    90  36xvvwwauej0  frontend  replicated  5/5       nginx:alpine
    91  74nzcxxjv6fq  backend   replicated  3/3       redis:3.0.6
    92  ```
    93  
    94  #### Name
    95  
    96  The `name` filter matches on all or part of a service's name.
    97  
    98  The following filter matches services with a name containing `redis`.
    99  
   100  ```bash
   101  $ docker service ls --filter name=redis
   102  ID            NAME   MODE        REPLICAS  IMAGE
   103  0bcjwfh8ychr  redis  replicated  1/1       redis:3.0.6
   104  ```
   105  
   106  ## Related information
   107  
   108  * [service create](service_create.md)
   109  * [service inspect](service_inspect.md)
   110  * [service logs](service_logs.md)
   111  * [service rm](service_rm.md)
   112  * [service scale](service_scale.md)
   113  * [service ps](service_ps.md)
   114  * [service update](service_update.md)