github.com/kim0/docker@v0.6.2-0.20161130212042-4addda3f07e7/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 ID NAME REPLICAS IMAGE COMMAND 38 c8wgl7q4ndfd frontend 5/5 nginx:alpine 39 dmu1ept4cxcf redis 3/3 redis:3.0.6 40 ``` 41 42 The `REPLICAS` column shows both the *actual* and *desired* number of tasks for 43 the service. 44 45 46 ## Filtering 47 48 The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more 49 than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`) 50 51 The currently supported filters are: 52 53 * [id](#id) 54 * [label](#label) 55 * [name](#name) 56 57 #### ID 58 59 The `id` filter matches all or part of a service's id. 60 61 ```bash 62 $ docker service ls -f "id=0bcjw" 63 ID NAME REPLICAS IMAGE COMMAND 64 0bcjwfh8ychr redis 1/1 redis:3.0.6 65 ``` 66 67 #### Label 68 69 The `label` filter matches services based on the presence of a `label` alone or 70 a `label` and a value. 71 72 The following filter matches all services with a `project` label regardless of 73 its value: 74 75 ```bash 76 $ docker service ls --filter label=project 77 ID NAME REPLICAS IMAGE COMMAND 78 01sl1rp6nj5u frontend2 1/1 nginx:alpine 79 36xvvwwauej0 frontend 5/5 nginx:alpine 80 74nzcxxjv6fq backend 3/3 redis:3.0.6 81 ``` 82 83 The following filter matches only services with the `project` label with the 84 `project-a` value. 85 86 ```bash 87 $ docker service ls --filter label=project=project-a 88 ID NAME REPLICAS IMAGE COMMAND 89 36xvvwwauej0 frontend 5/5 nginx:alpine 90 74nzcxxjv6fq backend 3/3 redis:3.0.6 91 ``` 92 93 94 #### Name 95 96 The `name` filter matches on all or part of a tasks'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 REPLICAS IMAGE COMMAND 103 0bcjwfh8ychr redis 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 rm](service_rm.md) 111 * [service scale](service_scale.md) 112 * [service ps](service_ps.md) 113 * [service update](service_update.md)