github.com/sld880311/docker@v0.0.0-20200524143708-d5593973a475/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 ## Description 33 34 This command when run targeting a manager, lists services are running in the 35 swarm. 36 37 ## Examples 38 39 On a manager node: 40 41 ```bash 42 $ docker service ls 43 44 ID NAME MODE REPLICAS IMAGE 45 c8wgl7q4ndfd frontend replicated 5/5 nginx:alpine 46 dmu1ept4cxcf redis replicated 3/3 redis:3.0.6 47 iwe3278osahj mongo global 7/7 mongo:3.3 48 ``` 49 50 The `REPLICAS` column shows both the *actual* and *desired* number of tasks for 51 the service. 52 53 ### Filtering 54 55 The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more 56 than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`) 57 58 The currently supported filters are: 59 60 * [id](service_ls.md#id) 61 * [label](service_ls.md#label) 62 * [name](service_ls.md#name) 63 64 #### id 65 66 The `id` filter matches all or part of a service's id. 67 68 ```bash 69 $ docker service ls -f "id=0bcjw" 70 ID NAME MODE REPLICAS IMAGE 71 0bcjwfh8ychr redis replicated 1/1 redis:3.0.6 72 ``` 73 74 #### label 75 76 The `label` filter matches services based on the presence of a `label` alone or 77 a `label` and a value. 78 79 The following filter matches all services with a `project` label regardless of 80 its value: 81 82 ```bash 83 $ docker service ls --filter label=project 84 ID NAME MODE REPLICAS IMAGE 85 01sl1rp6nj5u frontend2 replicated 1/1 nginx:alpine 86 36xvvwwauej0 frontend replicated 5/5 nginx:alpine 87 74nzcxxjv6fq backend replicated 3/3 redis:3.0.6 88 ``` 89 90 The following filter matches only services with the `project` label with the 91 `project-a` value. 92 93 ```bash 94 $ docker service ls --filter label=project=project-a 95 ID NAME MODE REPLICAS IMAGE 96 36xvvwwauej0 frontend replicated 5/5 nginx:alpine 97 74nzcxxjv6fq backend replicated 3/3 redis:3.0.6 98 ``` 99 100 #### name 101 102 The `name` filter matches on all or part of a service's name. 103 104 The following filter matches services with a name containing `redis`. 105 106 ```bash 107 $ docker service ls --filter name=redis 108 ID NAME MODE REPLICAS IMAGE 109 0bcjwfh8ychr redis replicated 1/1 redis:3.0.6 110 ``` 111 112 ## Related commands 113 114 * [service create](service_create.md) 115 * [service inspect](service_inspect.md) 116 * [service logs](service_logs.md) 117 * [service rm](service_rm.md) 118 * [service scale](service_scale.md) 119 * [service ps](service_ps.md) 120 * [service update](service_update.md)