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