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